Removed text commands
This commit is contained in:
1 parent
33e4d97be5
commit
27d2982b28
2 files changed
+3
-70
No files matched your search
@@ -19,15 +19,6 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
if (interaction.user.bot || !interaction.isCommand() || !interaction.guild)
|
if (interaction.user.bot || !interaction.isCommand() || !interaction.guild)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const args = [
|
|
||||||
interaction.commandName,
|
|
||||||
...client.commands
|
|
||||||
.find((cmd) => cmd.name.toLowerCase() == interaction.commandName)
|
|
||||||
.slashCommandOptions.map(
|
|
||||||
(v) => `${interaction.options.get(v.name).value}`
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
const NotValid = new Discord.MessageEmbed()
|
const NotValid = new Discord.MessageEmbed()
|
||||||
.setDescription(`:x: \`Invalid Command\` `)
|
.setDescription(`:x: \`Invalid Command\` `)
|
||||||
.setColor(supportbot.ErrorColour);
|
.setColor(supportbot.ErrorColour);
|
||||||
@@ -49,23 +40,15 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
embeds: [ValidPerms],
|
embeds: [ValidPerms],
|
||||||
});
|
});
|
||||||
interaction.author = interaction.user;
|
interaction.user = interaction.user;
|
||||||
command.run(interaction, args, client);
|
command.run(interaction);
|
||||||
}
|
}
|
||||||
if (interaction.isButton()) {
|
if (interaction.isButton()) {
|
||||||
if (interaction.customId === "openticket") {
|
if (interaction.customId === "openticket") {
|
||||||
interaction.message.fetch();
|
|
||||||
interaction.deferUpdate();
|
|
||||||
let message = {
|
|
||||||
guild: client.guilds.cache.get(interaction.message.guildId),
|
|
||||||
author: client.users.cache.get(interaction.user.id),
|
|
||||||
content: "N/A",
|
|
||||||
channel: client.channels.cache.get(interaction.message.channelId),
|
|
||||||
};
|
|
||||||
try {
|
try {
|
||||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||||
if (!cmd) return;
|
if (!cmd) return;
|
||||||
cmd.run(message, message.content);
|
cmd.run(interaction);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
// SupportBot | Emerald Services
|
|
||||||
// Message Create Event
|
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
|
||||||
const yaml = require('js-yaml');
|
|
||||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
|
||||||
|
|
||||||
const Event = require("../Structures/Event.js");
|
|
||||||
|
|
||||||
module.exports = new Event("messageCreate", (client, message) => {
|
|
||||||
if (message.author.bot) return;
|
|
||||||
|
|
||||||
if (!message.content.startsWith(client.prefix)) return;
|
|
||||||
|
|
||||||
const args = message.content.substring(client.prefix.length).split(/ +/);
|
|
||||||
|
|
||||||
const command = client.commands.find(cmd => cmd.name == args[0]);
|
|
||||||
|
|
||||||
const NotValid = new Discord.MessageEmbed()
|
|
||||||
.setDescription(`:x: \`${args[0]}\` is an Invalid Command `)
|
|
||||||
.setColor(supportbot.ErrorColour)
|
|
||||||
|
|
||||||
if (!command) return message.reply({
|
|
||||||
embeds: [NotValid]
|
|
||||||
});
|
|
||||||
|
|
||||||
const OnlySlashCmd = new Discord.MessageEmbed()
|
|
||||||
.setDescription(`:warning: That command is only useable as a \`Slash Command\` `)
|
|
||||||
.setColor(supportbot.WarnColour)
|
|
||||||
|
|
||||||
if (!["BOTH", "TEXT"].includes(command.type))
|
|
||||||
return message.reply({
|
|
||||||
embeds: [OnlySlashCmd]
|
|
||||||
})
|
|
||||||
|
|
||||||
const permission = message.member.permissions.has(command.permission, true);
|
|
||||||
|
|
||||||
const ValidPerms = new Discord.MessageEmbed()
|
|
||||||
.setDescription(":x: Do you have the \`${command.permission}\` permissions to execute this command?")
|
|
||||||
.setColor(supportbot.ErrorColour)
|
|
||||||
|
|
||||||
if (!permission)
|
|
||||||
return message.reply(
|
|
||||||
`You do not have the permission \`${command.permission}\` to run this command!`
|
|
||||||
);
|
|
||||||
|
|
||||||
command.run(message, args, client);
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user