mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-19 01:03:58 +00:00
31 lines
580 B
JavaScript
31 lines
580 B
JavaScript
export default {
|
|
name: 'aiResponse',
|
|
once: false,
|
|
async execute(client, config, aiRes) {
|
|
const response = config.responses.find(
|
|
(res) => res.label === aiRes.predictions[0].label
|
|
);
|
|
if (!response) return;
|
|
|
|
if (Number(aiRes.predictions[0].score) >= response.threshold) {
|
|
const ids = aiRes.id.split('/');
|
|
|
|
if (!response.text) return;
|
|
|
|
switch (ids[0]) {
|
|
case 'comment': {
|
|
client.getComment(ids[1]).reply(response.text);
|
|
break;
|
|
}
|
|
|
|
case 'post': {
|
|
client.getSubmission(ids[1]).reply(response.text);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
}
|
|
};
|