Updating how autoresponses are handled to be cleaner
This commit is contained in:
parent
bfa6e10011
commit
7003351ecc
49
functions.js
49
functions.js
@ -649,6 +649,55 @@ const functions = {
|
|||||||
|
|
||||||
return newText + ' <:spongebob:1053398825965985822>';
|
return newText + ' <:spongebob:1053398825965985822>';
|
||||||
},
|
},
|
||||||
|
autoresponses: { // Specific responses for certain keywords in sent messages
|
||||||
|
checkForAll(messageContent) {
|
||||||
|
let responses = [];
|
||||||
|
if (this.bigDoinks(messageContent)) responses.push("bigDoinks");
|
||||||
|
if (this.ligma(messageContent)) responses.push("ligma");
|
||||||
|
if (this.ong(messageContent)) responses.push("ong");
|
||||||
|
return responses;
|
||||||
|
},
|
||||||
|
bigDoinks(messageContent) {
|
||||||
|
let count = 0;
|
||||||
|
const { keywords } = strings.autoresponses.bigDoinks;
|
||||||
|
keywords.forEach(e => {
|
||||||
|
if (messageContent.includes(e)) count++;
|
||||||
|
});
|
||||||
|
if (count === keywords.length) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ligma(messageContent) {
|
||||||
|
let count = 0;
|
||||||
|
const { keywords } = strings.autoresponses.ligma;
|
||||||
|
keywords.forEach(e => {
|
||||||
|
if (messageContent.includes(e)) count++;
|
||||||
|
});
|
||||||
|
if (count > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ong(messageContent) {
|
||||||
|
let count = 0;
|
||||||
|
const { keywords } = strings.autoresponses.ong;
|
||||||
|
keywords.forEach(e => {
|
||||||
|
if (messageContent.includes(e)) count++;
|
||||||
|
});
|
||||||
|
if (count > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
send(message, responseType) {
|
||||||
|
const { responses } = strings.autoresponses[responseType];
|
||||||
|
const randomIndex = Math.floor(Math.random() * responses.length);
|
||||||
|
const response = responses[randomIndex];
|
||||||
|
try {
|
||||||
|
message.reply(response);
|
||||||
|
} catch(e) {
|
||||||
|
console.log(new Error(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
generateErrorId() {
|
generateErrorId() {
|
||||||
const digitCount = 10;
|
const digitCount = 10;
|
||||||
const digits = [];
|
const digits = [];
|
||||||
|
15
main.js
15
main.js
@ -221,17 +221,12 @@ client.on('messageCreate', message => {
|
|||||||
// Some basic checking to prevent running unnecessary code
|
// Some basic checking to prevent running unnecessary code
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
// Wildcard Responses, will respond if any message contains the trigger word(s), excluding self-messages
|
// Automatic Responses, will respond if any message contains the keyword(s), excluding self-messages
|
||||||
const lowerContent = message.content.toLowerCase();
|
const lowerContent = message.content.toLowerCase();
|
||||||
// big + doinks
|
const autoresponses = fn.autoresponses.checkForAll(lowerContent);
|
||||||
if (lowerContent.includes('big') && lowerContent.includes('doinks')) message.reply('gang.');
|
autoresponses.forEach(e => {
|
||||||
// ligma
|
fn.autoresponses.send(message, e);
|
||||||
if (lowerContent.includes('ligma')) message.reply('ligma balls, goteem');
|
});
|
||||||
// frfr, fr fr , bussin, ong
|
|
||||||
if (lowerContent.includes('frfr') || lowerContent.includes('fr fr') || lowerContent.includes('bussin') || lowerContent.includes(' ong') || lowerContent.startsWith('ong')) {
|
|
||||||
const randIndex = Math.floor(Math.random() * strings.capbacks.length);
|
|
||||||
message.reply(strings.capbacks[randIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Break the message down into its components and analyze it
|
// Break the message down into its components and analyze it
|
||||||
const commandData = fn.dot.getCommandData(message);
|
const commandData = fn.dot.getCommandData(message);
|
||||||
|
44
strings.json
44
strings.json
@ -14,14 +14,6 @@
|
|||||||
"urls": {
|
"urls": {
|
||||||
"avatar": "https://cdn.discordapp.com/avatars/513184762073055252/12227aa23a06d5178853e59b72c7487b.webp?size=128"
|
"avatar": "https://cdn.discordapp.com/avatars/513184762073055252/12227aa23a06d5178853e59b72c7487b.webp?size=128"
|
||||||
},
|
},
|
||||||
"capbacks": [
|
|
||||||
"on god?!",
|
|
||||||
"fr fr?!",
|
|
||||||
"no cap?!",
|
|
||||||
"no cap fr",
|
|
||||||
"bussin fr, no cap",
|
|
||||||
"ongggg no :billed_cap: fr fr"
|
|
||||||
],
|
|
||||||
"costs": {
|
"costs": {
|
||||||
"gpt": {
|
"gpt": {
|
||||||
"gpt-3.5-turbo": 0.2
|
"gpt-3.5-turbo": 0.2
|
||||||
@ -39,5 +31,41 @@
|
|||||||
"chatResCentsPer": 0.2,
|
"chatResCentsPer": 0.2,
|
||||||
"chatResUnits": 1000
|
"chatResUnits": 1000
|
||||||
},
|
},
|
||||||
|
"autoresponses": {
|
||||||
|
"bigDoinks": {
|
||||||
|
"keywords": ["big", "doinks"],
|
||||||
|
"responses": [
|
||||||
|
"<:bigdoinks:1053706618853924905> Gang.",
|
||||||
|
"<:bigdoinks:1053706618853924905> Out here in Amish",
|
||||||
|
"<:bigdoinks:1053706618853924905> Out here in Amish, smoking Big Doinks in Amish... Gang."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ligma": {
|
||||||
|
"keywords": ["ligma"],
|
||||||
|
"responses": [
|
||||||
|
"ligma balls lmao gottem",
|
||||||
|
"ligma balls ahaha",
|
||||||
|
"https://tenor.com/view/ligma-balls-gif-12236083",
|
||||||
|
"<:deadmonkey:1139186312444911707>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ong": {
|
||||||
|
"keywords": [
|
||||||
|
"frfr",
|
||||||
|
"fr fr",
|
||||||
|
"bussin",
|
||||||
|
"no cap",
|
||||||
|
" ong "
|
||||||
|
],
|
||||||
|
"responses": [
|
||||||
|
"on god?!",
|
||||||
|
"fr fr?!",
|
||||||
|
"no cap?!",
|
||||||
|
"no cap fr",
|
||||||
|
"bussin fr, no cap",
|
||||||
|
"ongggg no :billed_cap: fr fr"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"temp": {}
|
"temp": {}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user