Forward banned alts to mod channel
This commit is contained in:
@@ -46,6 +46,12 @@ export default {
|
|||||||
.setDescription('Set the new member logs channel.')
|
.setDescription('Set the new member logs channel.')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
)
|
)
|
||||||
|
.addChannelOption(option =>
|
||||||
|
option
|
||||||
|
.setName('moderator-channel')
|
||||||
|
.setDescription('Set the site moderator channel.')
|
||||||
|
.setRequired(false)
|
||||||
|
)
|
||||||
.addRoleOption(option =>
|
.addRoleOption(option =>
|
||||||
option
|
option
|
||||||
.setName('admin-role')
|
.setName('admin-role')
|
||||||
@@ -165,6 +171,14 @@ export default {
|
|||||||
response += `New member logs channel set to ${newMemberLogsChannel}.\n`;
|
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');
|
const adminRole = interaction.options.getRole('admin-role');
|
||||||
|
|
||||||
if (adminRole) {
|
if (adminRole) {
|
||||||
|
|||||||
@@ -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)}`;
|
const content = `${member.toString()}'s e621 and discord account(s):\n${await getE621Alts(member.id, member.guild)}`;
|
||||||
|
|
||||||
channel.send(content).catch(console.error);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,8 @@ const DB_SCHEMA = `
|
|||||||
staff_categories TEXT,
|
staff_categories TEXT,
|
||||||
safe_channels TEXT,
|
safe_channels TEXT,
|
||||||
link_skip_channels TEXT,
|
link_skip_channels TEXT,
|
||||||
github_release_channel TEXT
|
github_release_channel TEXT,
|
||||||
|
moderator_channel_id TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS messages (
|
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);
|
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) {
|
static async setGuildAdminRole(guildId: string, id: string) {
|
||||||
await Database.db.run('UPDATE settings SET admin_role_id = ? WHERE guild_id = ?', id, guildId);
|
await Database.db.run('UPDATE settings SET admin_role_id = ? WHERE guild_id = ?', id, guildId);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
@@ -23,6 +23,7 @@ export type GuildSettings = {
|
|||||||
safe_channels?: string
|
safe_channels?: string
|
||||||
link_skip_channels?: string
|
link_skip_channels?: string
|
||||||
github_release_channel?: string
|
github_release_channel?: string
|
||||||
|
moderator_channel_id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GuildArraySetting = 'staff_categories' | 'safe_channels' | 'link_skip_channels';
|
export type GuildArraySetting = 'staff_categories' | 'safe_channels' | 'link_skip_channels';
|
||||||
|
|||||||
Reference in New Issue
Block a user