|
1 | | -import { Client, ChannelType, PermissionFlagsBits } from 'discord.js'; |
| 1 | +import { ChannelType, Client, Events, Message, PermissionFlagsBits } from 'discord.js'; |
2 | 2 |
|
3 | | -import Event from './Event' |
4 | | -import Command from './Command' |
5 | | -import Utils from '../Utils' |
| 3 | +import Event from './Event'; |
| 4 | +import Command from './Command'; |
| 5 | +import Utils from '../Utils'; |
6 | 6 | import Feature from './Feature'; |
7 | 7 | import prisma from '../lib/prisma'; |
8 | 8 |
|
@@ -192,7 +192,8 @@ class Handler { |
192 | 192 | } |
193 | 193 |
|
194 | 194 | // Handle commands |
195 | | - this.client.on('messageCreate', async message => { |
| 195 | + this.client.on(Events.MessageCreate, async (message: Message) => { |
| 196 | + if (message.channel.type === ChannelType.GroupDM) return; |
196 | 197 | const guildSettings = await prisma.guild.upsert({ |
197 | 198 | where: { |
198 | 199 | id: message.guildId, |
@@ -224,24 +225,19 @@ class Handler { |
224 | 225 | return; |
225 | 226 | } |
226 | 227 |
|
227 | | - if (cmd.adminOnly && message.author.id !== '263349725099458566' && (message.channel.type === ChannelType.DM || !message.member.permissions.has('Administrator'))) { |
228 | | - return; |
| 228 | + if (cmd.adminOnly && |
| 229 | + message.author.id !== "263349725099458566" && |
| 230 | + ( |
| 231 | + message.channel.type === ChannelType.DM || |
| 232 | + !message.member.permissions.has(PermissionFlagsBits.Administrator)) |
| 233 | + ) { |
| 234 | + return; |
229 | 235 | } |
230 | | - if (cmd.adminOnly && |
231 | | - message.author.id !== "263349725099458566" && |
232 | | - ( |
233 | | - message.channel.type === ChannelType.DM || |
234 | | - !message.member.permissions.has(PermissionFlagsBits.Administrator)) |
235 | | - ) { |
236 | | - return; |
237 | | - } |
238 | | - |
239 | 236 |
|
240 | 237 | if (cmd.guildOnly && !message.guild) { |
241 | 238 | return; |
242 | 239 | } |
243 | 240 |
|
244 | | - |
245 | 241 | try { |
246 | 242 | await cmd.run(message, args); |
247 | 243 | console.log(`[LOG] ${message.author.tag} использовал ${cmd.name}`) |
|
0 commit comments