Fixed deploy command script and made the commands work. The bot is working as expected.

This commit is contained in:
Ahmad Khan 2023-09-28 16:42:57 -04:00
parent ef298accc3
commit 4a9f5538a3
6 changed files with 77 additions and 62 deletions

View file

@ -1,14 +1,16 @@
import { SlashCommandBuilder } from 'discord.js';
import { SlashCommandBuilder, CommandInteraction } from 'discord.js';
interface Command {
data: SlashCommandBuilder;
execute: (interaction: any) => Promise<void>;
data: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">;
execute: (interaction: CommandInteraction) => Promise<void>;
}
export const command: Command = {
data: new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'),
const command: Command = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
execute: async (interaction) => {
await interaction.reply('Pong!');
await interaction.reply(`Pong!`);
},
};

View file

@ -1,13 +1,17 @@
import { SlashCommandBuilder } from 'discord.js';
import { SlashCommandBuilder, CommandInteraction } from 'discord.js';
interface Command {
data: SlashCommandBuilder;
execute: (interaction: any) => Promise<void>;
data: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">;
execute: (interaction: CommandInteraction) => Promise<void>;
}
export const command: Command = {
data: new SlashCommandBuilder().setName('server').setDescription('Provides information about the server.'),
const command: Command = {
data: new SlashCommandBuilder()
.setName('server')
.setDescription('Provides information about the server.'),
execute: async (interaction) => {
await interaction.reply(`This server is ${interaction.guild.name} and has ${interaction.guild.memberCount} members.`);
await interaction.reply(`This server is ${interaction?.guild?.name} and has ${interaction?.guild?.memberCount} members.`);
},
};
export default command;

View file

@ -1,13 +1,21 @@
import { SlashCommandBuilder } from 'discord.js';
import { SlashCommandBuilder, CommandInteraction, GuildMember } from 'discord.js';
interface Command {
data: SlashCommandBuilder;
execute: (interaction: any) => Promise<void>;
data: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">;
execute: (interaction: CommandInteraction) => Promise<void>;
}
export const command: Command = {
data: new SlashCommandBuilder().setName('user').setDescription('Provides information about the user.'),
const command: Command = {
data: new SlashCommandBuilder()
.setName('user')
.setDescription('Provides information about the user.'),
execute: async (interaction) => {
await interaction.reply(`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`);
if (interaction.member instanceof GuildMember) {
await interaction.reply(`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`);
} else {
await interaction.reply(`This command was run by ${interaction.user.username}.`);
}
},
};
export default command;