From ee8452ce6a8434c31b4c20b5e83a40d5d8b016e4 Mon Sep 17 00:00:00 2001 From: The-Foxon Date: Fri, 28 Jul 2023 06:03:22 +1200 Subject: [PATCH] awqb --- src/index.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0e2942d..a11cd39 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,7 @@ import commands from './commands'; import { ServerInfoI } from './types/ServerInfoI'; import ChatController from './controller/ChatController'; import UserController from './controller/UserController'; +import EcoController from './controller/EcoController'; dotenv.config() @@ -15,12 +16,13 @@ const client = new Client({ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, - GatewayIntentBits.GuildMembers + GatewayIntentBits.GuildMembers, + GatewayIntentBits.MessageContent, ], partials: [ Partials.Message, Partials.Channel, - Partials.Reaction + Partials.Reaction, ], }); @@ -62,6 +64,23 @@ async function updateServerData() { } } +client.on(Events.MessageCreate, async (msg) => { + const ecoController = new EcoController() + + if (msg.channelId !== config.chatChannelId || !!msg.author.bot || msg.author.id === client.user?.id) + return + + const user = global.config.users.get(msg.author.id) + + try { + if (!user) return + msg.delete() + const uInfo = global.config.usersInGame.filter(u => u.SlgId === user.SlgId && u.SteamId === user.SteamId)[0] + + const status = await ecoController.Message(msg.content, uInfo.Name, `#${global.config.inGameChat}`) + } catch (error) { } +}) + client.on(Events.InteractionCreate, async interaction => { try { if (interaction.isChatInputCommand()) {