feat: platform specific responses

This commit is contained in:
GramingFoxTeam
2022-11-19 13:04:10 +03:00
parent 8d478a5d8b
commit 18e57b0c32
4 changed files with 28 additions and 9 deletions

View File

@@ -27,7 +27,20 @@
{
"label": "DOWNLOAD",
"threshold": 0.85,
"text": "you wanted peevanced"
"responses": [
{
"p": "discord",
"text": "you wanted peevanced"
},
{
"p": "telegram",
"text":"you wanted peevanced, on telegram"
},
{
"p": "reddit",
"text": "you wanted peevanced, on reddit"
}
]
}
]
}

View File

@@ -8,7 +8,7 @@ export default {
if (!response) return;
if (Number(aiRes.predictions[0].score) >= response.threshold) {
if (!response.text) return;
if (!response.responses[0]) return;
const ids = aiRes.id.split('/');
let channel = client.channels.cache.get(ids[0]);
@@ -24,8 +24,10 @@ export default {
await channel.messages.fetch(ids[1]);
message = channel.messages.cache.get(ids[1]);
}
message.reply(response.text);
const replyMsg = response.responses.find(res => res.p === 'discord').text;
message.reply(replyMsg);
return;
}

View File

@@ -10,16 +10,18 @@ export default {
if (Number(aiRes.predictions[0].score) >= response.threshold) {
const ids = aiRes.id.split('/');
if (!response.text) return;
if (!response.responses[0]) return;
const replyMsg = response.responses.find(res => res.p === 'reddit').text;
switch (ids[0]) {
case 'comment': {
client.getComment(ids[1]).reply(response.text);
client.getComment(ids[1]).reply(replyMsg);
break;
}
case 'post': {
client.getSubmission(ids[1]).reply(response.text);
client.getSubmission(ids[1]).reply(replyMsg);
break;
}
}

View File

@@ -10,9 +10,11 @@ export default {
if (Number(aiRes.predictions[0].score) >= response.threshold) {
const ids = aiRes.id.split('/');
if (!response.text) return;
if (!response.responses[0]) return;
bot.sendMessage(ids[0], response.text, {
const replyMsg = response.responses.find(res => res.p === 'telegram').text;
bot.sendMessage(ids[0], replyMsg, {
message_thread_id: ids[1],
reply_to_message_id: ids[2]
});