Forward banned alts to mod channel

This commit is contained in:
Tarrgon
2025-07-19 13:52:22 -04:00
parent 04982a06d6
commit 5b045de4bd
4 changed files with 27 additions and 1 deletions
+14
View File
@@ -46,6 +46,12 @@ export default {
.setDescription('Set the new member logs channel.')
.setRequired(false)
)
.addChannelOption(option =>
option
.setName('moderator-channel')
.setDescription('Set the site moderator channel.')
.setRequired(false)
)
.addRoleOption(option =>
option
.setName('admin-role')
@@ -165,6 +171,14 @@ export default {
response += `New member logs channel set to ${newMemberLogsChannel}.\n`;
}
const moderatorChannel = interaction.options.getChannel('moderator-channel');
if (moderatorChannel) {
await Database.setGuildModeratorChannel(interaction.guildId!, moderatorChannel.id);
response += `Moderator channel set to ${moderatorChannel}.\n`;
}
const adminRole = interaction.options.getRole('admin-role');
if (adminRole) {
+6
View File
@@ -13,6 +13,12 @@ export async function handleMemberJoin(member: GuildMember) {
const content = `${member.toString()}'s e621 and discord account(s):\n${await getE621Alts(member.id, member.guild)}`;
channel.send(content).catch(console.error);
if (guildSettings.moderator_channel_id && content.includes('[BANNED]')) {
const modChannel = await member.guild.channels.fetch(guildSettings.moderator_channel_id) as GuildTextBasedChannel;
if (modChannel) modChannel.send(content).catch(console.error);
}
}
}
}
+6 -1
View File
@@ -29,7 +29,8 @@ const DB_SCHEMA = `
staff_categories TEXT,
safe_channels TEXT,
link_skip_channels TEXT,
github_release_channel TEXT
github_release_channel TEXT,
moderator_channel_id TEXT
);
CREATE TABLE IF NOT EXISTS messages (
@@ -180,6 +181,10 @@ export class Database {
await Database.db.run('UPDATE settings SET new_member_channel_id = ? WHERE guild_id = ?', id, guildId);
}
static async setGuildModeratorChannel(guildId: string, id: string) {
await Database.db.run('UPDATE settings SET moderator_channel_id = ? WHERE guild_id = ?', id, guildId);
}
static async setGuildAdminRole(guildId: string, id: string) {
await Database.db.run('UPDATE settings SET admin_role_id = ? WHERE guild_id = ?', id, guildId);
}
+1
View File
@@ -23,6 +23,7 @@ export type GuildSettings = {
safe_channels?: string
link_skip_channels?: string
github_release_channel?: string
moderator_channel_id?: string
}
export type GuildArraySetting = 'staff_categories' | 'safe_channels' | 'link_skip_channels';