1 |
import BaseEvent from '../../utils/structures/BaseEvent'; |
2 |
import DiscordClient from '../../client/Client'; |
3 |
import { LogLevel } from '../../services/DebugLogger'; |
4 |
import { Guild } from 'discord.js'; |
5 |
|
6 |
export default class GuildCreateEvent extends BaseEvent { |
7 |
constructor() { |
8 |
super('guildCreate'); |
9 |
} |
10 |
|
11 |
async run(client: DiscordClient, guild: Guild) { |
12 |
await client.debugLogger.logLeaveJoin(LogLevel.INFO, `Joined a guild: ${guild.name} [ID: ${guild.id}]`); |
13 |
|
14 |
if (!client.config.props[guild.id]) { |
15 |
await client.debugLogger.logLeaveJoin(LogLevel.CRITICAL, `Unauthorized guild detected: ${guild.name} [ID: ${guild.id}]`); |
16 |
await guild.leave(); |
17 |
} |
18 |
} |
19 |
} |