confoss/src/commands/confessbanlist.ts

47 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-10-13 12:57:45 -04:00
/*
* Confoss: Anonymous confessions for Discord, free as in freedom and price!
* Copyright (C) 2024 powermaker450
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2024-10-13 13:22:49 -04:00
import {
CommandInteraction,
PermissionFlagsBits,
SlashCommandBuilder
} from "discord.js";
2024-10-13 12:57:45 -04:00
import { dt } from "../main";
export const data = new SlashCommandBuilder()
.setName("confessbanlist")
.setDescription("Get the current ban list")
2024-10-13 13:22:49 -04:00
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages);
2024-10-13 12:57:45 -04:00
export async function execute(interaction: CommandInteraction) {
const bannedMembers = dt.getBans(interaction.guild?.id!);
2024-10-13 13:22:49 -04:00
let content = bannedMembers.length
? "Banned Members:\n"
: "There are no banned members.";
2024-10-13 12:57:45 -04:00
for (const member of bannedMembers) {
2024-10-13 15:54:40 -04:00
content += `\n<@${member.user}> | \`${member.confessionId}\``;
2024-10-13 12:57:45 -04:00
}
return interaction.reply({
content: content,
ephemeral: true
2024-10-13 13:22:49 -04:00
});
2024-10-13 12:57:45 -04:00
}