generated from nhcarrigan/template
feat: rewrite as moderation bot #11
+12
-5
@@ -20,6 +20,7 @@ import { softbanCommand } from "./commands/softban.js";
|
||||
import { unbanCommand } from "./commands/unban.js";
|
||||
import { unmuteCommand } from "./commands/unmute.js";
|
||||
import { warnCommand } from "./commands/warn.js";
|
||||
import { guildConfig } from "./config/guild.js";
|
||||
// eslint-disable-next-line stylistic/max-len -- Import path cannot be shortened
|
||||
import { onGuildAuditLogEntryCreate } from "./events/guildAuditLogEntryCreate.js";
|
||||
import { onGuildMemberAdd } from "./events/guildMemberAdd.js";
|
||||
@@ -127,11 +128,17 @@ client.on(Events.GuildAuditLogEntryCreate, (entry, guild) => {
|
||||
void onGuildAuditLogEntryCreate(entry, guild, client);
|
||||
});
|
||||
|
||||
client.on(Events.ClientReady, () => {
|
||||
void logger.log(
|
||||
"debug",
|
||||
`Keiko is online as ${client.user?.username ?? "unknown"}.`,
|
||||
);
|
||||
client.on(Events.ClientReady, (readyClient) => {
|
||||
void (async(): Promise<void> => {
|
||||
const guild = readyClient.guilds.cache.get(guildConfig.guildId);
|
||||
if (guild) {
|
||||
await guild.members.fetch();
|
||||
}
|
||||
await logger.log(
|
||||
"debug",
|
||||
`Keiko is online as ${readyClient.user.username}.`,
|
||||
);
|
||||
})();
|
||||
});
|
||||
|
||||
await client.login(process.env.DISCORD_TOKEN);
|
||||
|
||||
@@ -29,6 +29,7 @@ const commandData = [
|
||||
|
||||
const rest = new REST().setToken(process.env.DISCORD_TOKEN ?? "");
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- REST returns unknown; shape is documented by Discord API */
|
||||
const me = await rest.get(Routes.user()) as { id: string; username: string };
|
||||
console.log(`Authenticated as: ${me.username} (${me.id})`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user