awqb
This commit is contained in:
parent
78706d3eca
commit
ee8452ce6a
23
src/index.ts
23
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()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user