wolfcountBot/events/messageCreate.js

54 lines
2.0 KiB
JavaScript
Raw Normal View History

2023-04-28 07:48:43 -04:00
const client = require("../index");
const wolfcount = require('../models/wolfcount');
// When a message is sent, check if the message includes the letters of wolf
const wolfChars = ['w', 'o', 'l', 'f'];
client.on("messageCreate", async (message) => {
if (message.author.bot) return;
2023-05-24 04:31:35 -04:00
if (message.content.includes(">>") || message.content.includes(">r>")) return;
2023-04-28 07:48:43 -04:00
// convert the message to lowercase
const lowerMsg = message.content.toLowerCase();
// console.log(lowerMsg);
// check if the message has the letters
if (wolfChars.every(char=>lowerMsg.includes(char))) {
message.react("🐺").catch(err=>console.log(err));
newcount = basecount + 1;
// client.user.setPresence({
// // activities: [{ name: `${newcount} message(s) detected`, type: ActivityType.Watching }],
// activities: [{ name: `${newcount} message(s) detected` }],
// status: 'dnd',
// });
basecount = newcount;
console.log('');
console.log('Live wolf count:', newcount);
2023-05-24 04:31:35 -04:00
if (newcount == 69) {
message.react("1103666748592488549").catch(err=>console.log(err)); // pogslide
message.react("1103673748466434140").catch(err=>console.log(err)); // 69nice
}
if (newcount == 100) {
message.react("💯").catch(err=>console.log(err));
message.react("1103666748592488549").catch(err=>console.log(err)); // pogslide
}
if (newcount == 420) {
message.react("1103666748592488549").catch(err=>console.log(err)); // pogslide
message.react("1103675067054948392").catch(err=>console.log(err)); // pepe_high
}
2023-04-28 07:48:43 -04:00
// update the wolf count
2024-03-03 05:45:24 -05:00
wolfcount.findByIdAndUpdate(`${process.env.UPDATEID}`, {count: newcount}).then(() => {
2023-04-28 07:48:43 -04:00
console.log('Count updated!');
}).catch((error) => {
console.error(error);
});
}
});