mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
28 lines
775 B
JavaScript
28 lines
775 B
JavaScript
export default {
|
|
name: 'aiResponse',
|
|
once: false,
|
|
async execute(bot, config, aiRes) {
|
|
if (!aiRes.response) return;
|
|
if (!aiRes.response[0]) return;
|
|
const ids = aiRes.id.split('/');
|
|
const intent = aiRes.response.reduce((a, b) =>
|
|
a.confidence > b.confidence ? a : b
|
|
);
|
|
const response = config.responses.find((res) => res.label === intent.name);
|
|
if (response.threshold > intent.confidence) return;
|
|
if (!response.reply) return;
|
|
|
|
bot.sendMessage(
|
|
ids[0],
|
|
`## ${response.reply.title}\n\n${response.reply.desc}\n\n_Confidence: ${intent.confidence}_\n\nThis bot is currently being tested in production. Ignore it, if it's wrong.`,
|
|
{
|
|
message_thread_id: ids[1],
|
|
reply_to_message_id: ids[2],
|
|
parse_mode: 'Markdown'
|
|
}
|
|
);
|
|
|
|
return;
|
|
}
|
|
};
|