mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
25 lines
422 B
JavaScript
25 lines
422 B
JavaScript
import { serialize } from 'bson';
|
|
|
|
export default async function runAI(client, data, config) {
|
|
const witAIReq = await fetch(
|
|
`https://api.wit.ai/message?v20230319&q=${encodeURI(data.text)}`,
|
|
{
|
|
headers: {
|
|
authorization: `Bearer ${config.authToken}`
|
|
}
|
|
}
|
|
);
|
|
|
|
const response = await witAIReq.json();
|
|
|
|
client.write(
|
|
serialize({
|
|
op: 2,
|
|
id: data.id,
|
|
response: response.intents
|
|
})
|
|
);
|
|
|
|
return;
|
|
}
|