Add Sentinel anti-nuke listeners, federation role syncing, ticket system, and admin commands to the unified AeThex bot, consolidating functionality and enhancing security monitoring. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e72fc1b7-94bd-4d6c-801f-cbac2fae245c Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 00c4494a-b436-4e48-b794-39cd745fb604 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/e72fc1b7-94bd-4d6c-801f-cbac2fae245c/7DQc4BR Replit-Helium-Checkpoint-Created: true
114 lines
3.7 KiB
JavaScript
114 lines
3.7 KiB
JavaScript
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('federation')
|
|
.setDescription('Manage cross-server role sync')
|
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
|
.addSubcommand(subcommand =>
|
|
subcommand
|
|
.setName('link')
|
|
.setDescription('Link a role for cross-server syncing')
|
|
.addRoleOption(option =>
|
|
option.setName('role')
|
|
.setDescription('Role to sync across realms')
|
|
.setRequired(true)
|
|
)
|
|
)
|
|
.addSubcommand(subcommand =>
|
|
subcommand
|
|
.setName('unlink')
|
|
.setDescription('Remove a role from cross-server syncing')
|
|
.addRoleOption(option =>
|
|
option.setName('role')
|
|
.setDescription('Role to remove from sync')
|
|
.setRequired(true)
|
|
)
|
|
)
|
|
.addSubcommand(subcommand =>
|
|
subcommand
|
|
.setName('list')
|
|
.setDescription('List all linked roles')
|
|
),
|
|
|
|
async execute(interaction, supabase, client) {
|
|
const subcommand = interaction.options.getSubcommand();
|
|
|
|
if (subcommand === 'link') {
|
|
const role = interaction.options.getRole('role');
|
|
|
|
if (client.federationMappings.has(role.id)) {
|
|
return interaction.reply({
|
|
content: `${role} is already linked for federation sync.`,
|
|
ephemeral: true,
|
|
});
|
|
}
|
|
|
|
client.federationMappings.set(role.id, {
|
|
name: role.name,
|
|
guildId: interaction.guild.id,
|
|
createdAt: Date.now(),
|
|
});
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor(0x00ff00)
|
|
.setTitle('Role Linked')
|
|
.setDescription(`${role} will now sync across all realm servers.`)
|
|
.addFields(
|
|
{ name: 'Role Name', value: role.name, inline: true },
|
|
{ name: 'Source Guild', value: interaction.guild.name, inline: true }
|
|
)
|
|
.setFooter({ text: 'Users with this role will receive it in all connected realms.' })
|
|
.setTimestamp();
|
|
|
|
await interaction.reply({ embeds: [embed] });
|
|
|
|
client.sendAlert(`Federation: Role ${role.name} linked by ${interaction.user.tag}`);
|
|
}
|
|
|
|
if (subcommand === 'unlink') {
|
|
const role = interaction.options.getRole('role');
|
|
|
|
if (!client.federationMappings.has(role.id)) {
|
|
return interaction.reply({
|
|
content: `${role} is not linked for federation sync.`,
|
|
ephemeral: true,
|
|
});
|
|
}
|
|
|
|
client.federationMappings.delete(role.id);
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor(0xff0000)
|
|
.setTitle('Role Unlinked')
|
|
.setDescription(`${role} will no longer sync across realm servers.`)
|
|
.setTimestamp();
|
|
|
|
await interaction.reply({ embeds: [embed] });
|
|
|
|
client.sendAlert(`Federation: Role ${role.name} unlinked by ${interaction.user.tag}`);
|
|
}
|
|
|
|
if (subcommand === 'list') {
|
|
const mappings = [...client.federationMappings.entries()];
|
|
|
|
if (mappings.length === 0) {
|
|
return interaction.reply({
|
|
content: 'No roles are currently linked for federation sync.',
|
|
ephemeral: true,
|
|
});
|
|
}
|
|
|
|
const roleList = mappings.map(([roleId, data]) => `<@&${roleId}> - Added <t:${Math.floor(data.createdAt / 1000)}:R>`).join('\n');
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor(0x7c3aed)
|
|
.setTitle('Federation Linked Roles')
|
|
.setDescription(roleList)
|
|
.setFooter({ text: `${mappings.length} role(s) linked` })
|
|
.setTimestamp();
|
|
|
|
await interaction.reply({ embeds: [embed], ephemeral: true });
|
|
}
|
|
},
|
|
};
|