diff --git a/src/discord/events/messageCreate.ts b/src/discord/events/messageCreate.ts index 3800908cf..4646a15dd 100644 --- a/src/discord/events/messageCreate.ts +++ b/src/discord/events/messageCreate.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ // import { // ChannelType, // } from 'discord-api-types/v10'; @@ -56,70 +55,70 @@ async function getCategory(channel:TextChannel):Promise { export const messageCreate: MessageCreateEvent = { name: 'messageCreate', async execute(message) { - // messageCommand(message); - // bridgeMessage(message); + messageCommand(message); + bridgeMessage(message); // awayMessage(message); // Only run on Tripsit or DM, we don't want to snoop on other guilds ( ͡~ ͜ʖ ͡°) - // if (message.guild && message.guild.id !== env.DISCORD_GUILD_ID) { - // return; - // } + if (message.guild && message.guild.id !== env.DISCORD_GUILD_ID) { + return; + } - // const userData = await db.users.upsert({ - // where: { - // discord_id: message.author.id, - // }, - // create: { - // discord_id: message.author.id, - // }, - // update: {}, - // }); - - // if (userData && userData.discord_bot_ban) { - // return; - // } + const userData = await db.users.upsert({ + where: { + discord_id: message.author.id, + }, + create: { + discord_id: message.author.id, + }, + update: {}, + }); + + if (userData && userData.discord_bot_ban) { + return; + } + + // log.debug(F, `Message: ${JSON.stringify(message, null, 2)}`); + + // This needs to run here because the widget bot peeps will use this and they are "bot users" + // This handles ~ commands - // // log.debug(F, `Message: ${JSON.stringify(message, null, 2)}`); - - // // This needs to run here because the widget bot peeps will use this and they are "bot users" - // // This handles ~ commands - - // // Don't run on bots - // if (message.author.bot) return; - // countMessage(message); - // youAre(message); - // karma(message); - // imagesOnly(message); - // discordAiModerate(message); - - // // Disabled for testing - // // thoughtPolice(message); - - // // // If this is a DM, run the modmail function. - // // if (message.channel.type === ChannelType.DM) { - // // await modmailDMInteraction(message); - // // } - - // // Determine if the bot should give exp - // if ( - // message.member // Is not a member of a guild - // && message.channel // Was not sent in a channel - // && (message.channel instanceof TextChannel) // Was not sent in a text channel - // && message.guild // Was not sent in a guild - // && !ignoredRoles.some(role => message.member?.roles.cache.has(role)) // Has a role that should be ignored - // ) { - // // Determine what kind of experience to give - // const experienceCategory = await getCategory(message.channel); - // // Run this now, so that when you're helping in the tech/tripsit rooms you'll always get exp - // experience(message.member, experienceCategory, 'TEXT' as experience_type, message.channel); + // Don't run on bots + if (message.author.bot) return; + countMessage(message); + youAre(message); + karma(message); + imagesOnly(message); + discordAiModerate(message); + + // Disabled for testing + // thoughtPolice(message); + + // // If this is a DM, run the modmail function. + // if (message.channel.type === ChannelType.DM) { + // await modmailDMInteraction(message); // } - // // Check if the message came in a thread in the helpdesk channel + // Determine if the bot should give exp + if ( + message.member // Is not a member of a guild + && message.channel // Was not sent in a channel + && (message.channel instanceof TextChannel) // Was not sent in a text channel + && message.guild // Was not sent in a guild + && !ignoredRoles.some(role => message.member?.roles.cache.has(role)) // Has a role that should be ignored + ) { + // Determine what kind of experience to give + const experienceCategory = await getCategory(message.channel); + // Run this now, so that when you're helping in the tech/tripsit rooms you'll always get exp + experience(message.member, experienceCategory, 'TEXT' as experience_type, message.channel); + } - // // if (message.channel.isThread()) { - // // modmailThreadInteraction(message); - // // } + // Check if the message came in a thread in the helpdesk channel + + // if (message.channel.isThread()) { + // modmailThreadInteraction(message); + // } - // announcements(message); + announcements(message); }, };