mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-05-10 10:43:06 +00:00
Fixes and Improvements
This commit is contained in:
parent
4c5a8d2e66
commit
82f354db1c
12 changed files with 137 additions and 105 deletions
|
@ -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] });
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue