diff --git a/src/discord/Help.ts b/src/discord/Help.ts index c217a62..a58dcec 100644 --- a/src/discord/Help.ts +++ b/src/discord/Help.ts @@ -1,4 +1,4 @@ -import { Interaction, Message } from "discord.js"; +import { CommandInteraction, Interaction, Message } from "discord.js"; import { getEmotes, makeSuccessEmbed, makeProcessingEmbed, sendMessage, sendReply, makeInfoEmbed } from "../utils/DiscordMessage"; import DiscordProvider from "../providers/Discord"; @@ -9,8 +9,10 @@ export default class Help { this.sendHelpMessage(false, message); } - async interactionCreate(interaction: Interaction) { - this.sendHelpMessage(true, interaction); + async interactionCreate(interaction: CommandInteraction) { + if(typeof interaction.commandName === 'undefined') return; + if((interaction.commandName).toLowerCase() !== 'help') return; + await this.sendHelpMessage(true, interaction); } async sendHelpMessage(isSlashCommand: boolean, data: any) { @@ -32,11 +34,11 @@ export default class Help { value: '``help``\n``ping``\n``invite``\n``membershipscreening (ms)``\n``...14 commands has been hidden (FLAGS.BETA)``' } ], - user: data.author + user: isSlashCommand ? data.user : data.author }); if(isSlashCommand) { - data.replay({ ephemeral: true, embeds: [embed] }); + data.reply({ ephemeral: false, embeds: [embed] }); } else { diff --git a/src/discord/Invite.ts b/src/discord/Invite.ts new file mode 100644 index 0000000..ad2e9cd --- /dev/null +++ b/src/discord/Invite.ts @@ -0,0 +1,37 @@ +import { Message, CommandInteraction } from "discord.js"; +import { getEmotes, makeSuccessEmbed, makeProcessingEmbed, sendMessage, sendReply, makeInfoEmbed } from "../utils/DiscordMessage"; +import DiscordProvider from "../providers/Discord"; + +export default class Invite { + async onCommand(command: string, args: any, message: Message) { + if(command.toLowerCase() !== 'invite') return; + + await this.sendInviteMessage(false, message); + + } + + async interactionCreate(interaction: CommandInteraction) { + if(typeof interaction.commandName === 'undefined') return; + if((interaction.commandName).toLowerCase() !== 'invite') return; + await this.sendInviteMessage(true, interaction); + } + + async sendInviteMessage(isSlashCommand: boolean, data: any) { + + const embed = makeInfoEmbed({ + title: `Invite`, + description: `${DiscordProvider.client.user?.username}'s invite is currently disabled. Only the developers can add me to another server`, + user: isSlashCommand ? data.user : data.author + }); + + if(isSlashCommand) { + data.reply({ ephemeral: false, embeds: [embed] }); + } + else { + let help = await sendReply(data, { + embeds: [embed] + }); + } + + } +} \ No newline at end of file