From 1651b70f1a3bfda4e7223f68bad333f53bd37bd5 Mon Sep 17 00:00:00 2001 From: Yoru Date: Mon, 3 Jun 2024 15:16:28 +0300 Subject: [PATCH] fix :3 and some other stuff --- src/listeners/messageCreate.ts | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/listeners/messageCreate.ts b/src/listeners/messageCreate.ts index 630471c..4901d63 100644 --- a/src/listeners/messageCreate.ts +++ b/src/listeners/messageCreate.ts @@ -15,6 +15,7 @@ export default { const cooldown = new Map(); +const CHANCE_TO_SEND_CUTE_KITTY_CAT_I_LOVE_CATS = 0.2; async function run(message: Message): Promise { if (message.channelId === "1193529619907891331") { verifyUser(message); @@ -24,18 +25,6 @@ async function run(message: Message): Promise { const { content, guildId, client, author } = message; if (!content || !guildId || author.bot) return; - // nyann :3333 - const CHANCE_TO_SEND_CUTE_KITTY_CAT_I_LOVE_CATS = 0.6; - if (content === ":3" || content === "3:" && Math.random() > CHANCE_TO_SEND_CUTE_KITTY_CAT_I_LOVE_CATS) { - await message.reply(message.content === ":3" ? "3:" : ":3"); - return; - } - - if (content.includes("727") || content.includes("7,27") || content.includes("72,7") || content.toLowerCase().includes("wysi")) { - await message.react("wysia:1240624238189088869", true); - return; - } - const prefixes = prefixesCache.get(guildId) ?? DEFAULT_PREFIX; let prefix: string | null = null; @@ -46,8 +35,20 @@ async function run(message: Message): Promise { break; } } - if (prefix === null) + + if (prefix === null) { + // nyann :3333 + if ((content === ":3" || content === "3:") && Math.random() < CHANCE_TO_SEND_CUTE_KITTY_CAT_I_LOVE_CATS) { + await message.reply(message.content === ":3" ? "3:" : ":3", { allowed_mentions: { replied_user: false, parse: [], roles: [], users: [] } }); + return; + } + + if (content === "727" || content === "7,27" || content === "72,7" || content === "72.7" || content === "7.27" || content.toLowerCase() === "wysi") { + await message.react("wysia:1240624238189088869", true); + return; + } return; + } const args = content.slice(prefix.length).trim().split(/ +/g); let commandName = args.shift()?.toLowerCase(); @@ -78,7 +79,7 @@ async function run(message: Message): Promise { if (nearResults === "") return; - await message.reply(`It seems like ${commandName} is not a command. Did you mean: \`${nearResults}\`?`); + await message.reply(`It seems like ${commandName} is not a command. Did you mean: \`${nearResults}\`?`, { allowed_mentions: { replied_user: false, parse: [], roles: [], users: [] } }); return; } const { default: command } = commandDefault; @@ -111,11 +112,14 @@ async function run(message: Message): Promise { } catch (error) { const err = error as Error; - await message.reply(`Oops, you came across an error!\nHere's a summary of it:\n\`\`\`${err.stack}\`\`\`\nDon't worry, the same error log has been sent to the owner of this bot.`); + await message.reply( + `Oops, you came across an error!\nHere's a summary of it:\n\`\`\`${err.stack}\`\`\`\nDon't worry, the same error log has been sent to the owner of this bot.`, + { allowed_mentions: { replied_user: false, parse: [], roles: [], users: [] } } + ); const guild = await client.rest.getGuild(guildId); - await client.rest.createMessage(message.channelId, { + await client.rest.createMessage(process.env.ERROR_CHANNEL_ID, { content: `<@${process.env.OWNER_ID}> STACK ERROR, GET YOUR ASS TO WORK`, embeds: [ {