Added more Commands
This commit is contained in:
@@ -1,39 +1,39 @@
|
||||
const {InteractionType} = require("discord.js")
|
||||
const { InteractionType } = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'interactionCreate',
|
||||
|
||||
/**
|
||||
* @param {CommandInteraction} interaction
|
||||
* @param {Client} client
|
||||
/**
|
||||
* @param {CommandInteraction} interaction
|
||||
* @param {Client} client
|
||||
*/
|
||||
|
||||
async execute(interaction, client) {
|
||||
|
||||
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
||||
|
||||
|
||||
const command = client.slash.get(interaction.commandName);
|
||||
if (!command) return interaction.reply({ content: `Command doesn't exist!`, ephemeral: true });
|
||||
|
||||
if (command.ownerOnly) {
|
||||
if (interaction.user.id !== client.config.ownerID) {
|
||||
return interaction.reply({ content: `Permission Denied`, ephemeral: true });
|
||||
if (!command) return interaction.reply({content: `❌ Error processing this command.`, ephemeral: true });
|
||||
|
||||
if(command.ownerOnly) {
|
||||
if(interaction.user.id !== client.config.ownerID) {
|
||||
return interaction.reply({content: `❌ Permission denied`, ephemeral: true })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const args = [];
|
||||
|
||||
|
||||
for (let option of interaction.options.data) {
|
||||
if (option.type === 'SUB_COMMAND') {
|
||||
if (option.name) args.push(option.name);
|
||||
if(option.name) args.push(option.name);
|
||||
option.options?.forEach(x => {
|
||||
if (x.value) args.push(x.value);
|
||||
if(x.value) args.push(x.value);
|
||||
});
|
||||
} else if (option.value) args.push(option.value);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
command.run(client, interaction, args)
|
||||
} catch (e) {
|
||||
interaction.reply({ content: e.message });
|
||||
} catch (error) {
|
||||
interaction.reply({ content: error.message })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'messageCreate',
|
||||
|
||||
/**
|
||||
* @param {Message} message
|
||||
* @param {Client} client
|
||||
*/
|
||||
async execute(message, client) {
|
||||
if (message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(client.config.botPrefix)) return;
|
||||
const [cmd, ...args] = message.content.slice(client.config.botPrefix.length).trim().split(" ");
|
||||
const command = client.commands.get(cmd.toLowerCase()) || client.commands.find(c => c.aliases?.includes(cmd.toLowerCase()));
|
||||
|
||||
//Se quiser que o bot não retorne nada caso o comando não existe
|
||||
//if (!command) { return }
|
||||
|
||||
//Se quiser que o bot retorne alguma mensagem
|
||||
if (!command) {
|
||||
return message.reply({ content: `:x: **|** Comando não encontrado` })
|
||||
}
|
||||
|
||||
//Se quiser que o bot não retorne nada ao usar um comando apenas para dev
|
||||
/*if (command.ownerOnly) {
|
||||
if (message.author.id !== client.config.ownerID) { return }
|
||||
}*/
|
||||
|
||||
//se quiser que o bot retorne alguma mensagem
|
||||
if (command.ownerOnly) {
|
||||
if (message.author.id !== client.config.ownerID) {
|
||||
return message.reply({ content: `:x: **|** Apenas meu criador pode usar esse comando!` })
|
||||
}
|
||||
}
|
||||
|
||||
await command.run(client, message, args);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,15 @@
|
||||
const client = require("../../index");
|
||||
const { ActivityType } = require('discord.js')
|
||||
const chalk = require("chalk");
|
||||
const { joinVoiceChannel } = require("@discordjs/voice");
|
||||
const Discord = require('discord.js')
|
||||
const Discord = require('discord.js');
|
||||
const chalk = require('chalk');
|
||||
|
||||
module.exports = {
|
||||
name: 'ready',
|
||||
once: true,
|
||||
|
||||
/**
|
||||
* @param {Client} client
|
||||
*/
|
||||
async execute(client) {
|
||||
|
||||
let status = [
|
||||
`by info@noahpombas.ch`,
|
||||
`Spoiler: novo Servidor de Minecraft brevemente`
|
||||
],
|
||||
i = 0
|
||||
setInterval(() => {
|
||||
client.user.setActivity(`${status[i++ % status.length]}`, {
|
||||
type: ActivityType.Streaming
|
||||
})
|
||||
}, 5000);
|
||||
name: 'ready',
|
||||
once: true,
|
||||
/** @param {Client} client */
|
||||
async execute(client) {
|
||||
client.setMaxListeners(0);
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(chalk.blueBright(`[READY] Bot Online!`));
|
||||
}
|
||||
}
|
||||
console.log(chalk.blueBright(`${client.user.username} is Online and inside ${client.guilds.cache.size} servers!`));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user