Fixes and Improvements

This commit is contained in:
Ahmad 2024-12-07 15:47:21 -05:00
parent 4c5a8d2e66
commit 82f354db1c
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
12 changed files with 137 additions and 105 deletions

View file

@ -1,22 +1,29 @@
import { SlashCommandBuilder, CommandInteraction, EmbedBuilder } from "discord.js";
import { getAllMembers } from "../util/db.js";
import {
SlashCommandBuilder,
CommandInteraction,
EmbedBuilder,
} from 'discord.js';
import { getAllMembers } from '../util/db.js';
interface Command {
data: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">;
data: Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
execute: (interaction: CommandInteraction) => Promise<void>;
}
const command: Command = {
data: new SlashCommandBuilder()
.setName("members")
.setDescription("Lists all non-bot members of the server"),
.setName('members')
.setDescription('Lists all non-bot members of the server'),
execute: async (interaction) => {
const members = await getAllMembers();
const memberList = members.map(m => `**${m.discordUsername}** (${m.discordId})`).join("\n");
const memberList = members
.map((m) => `**${m.discordUsername}** (${m.discordId})`)
.join('\n');
const membersEmbed = new EmbedBuilder()
.setTitle("Members")
.setTitle('Members')
.setDescription(memberList)
.setColor(0x0099ff);
.setColor(0x0099ff)
.addFields({ name: 'Total Members', value: members.length.toString() });
await interaction.reply({ embeds: [membersEmbed] });
},
};