Skip to content

Commit

Permalink
Fix owner commands
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorKowalczyk committed May 5, 2022
1 parent ff17e8e commit 2832517
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion bot/events/guild/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = async (client, message) => {
// .setTitle(`${client.bot_emojis.success} Hi!`, message.guild.iconURL())
.setColor("GREEN")
.setAuthor({ name: `${client.bot_emojis.wave} Hello ${message.author.username}`, iconURL: client.user.displayAvatarURL({ dynamic: true, format: "png", size: 2048 }) })
.setDescription(`> I was pinged by you, here I am - <@${client.user.id}>!\n> To see all my commands please type \`/help\`!\n\n>>> ${client.bot_emojis.slash_commands} *Note: Majo.exe will soon switch to slash commands (/)!\nWe are still working on this feature so please be patient :tada:!\n\nMajo.exe will stop responding to normal prefixes <t:1651269660:R>*`)
.setDescription(`> I was pinged by you, here I am - <@${client.user.id}>!\n> To see all my commands please type \`/help\` (as slash command ${client.bot_emojis.slash_command})!`)
.setTimestamp()
.setThumbnail(client.user.displayAvatarURL({ dynamic: true, format: "png", size: 2048 }))
.setFooter({
Expand Down
20 changes: 0 additions & 20 deletions bot/handlers/slash_command.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,5 @@ const fetch = require("node-fetch");
module.exports = async (client) => {
console.log(chalk.bold(chalk.green.bold("> ") + chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(" Registering slash commands..."));
await client.application.commands.set(client.slash_commands_array);
//console.log(chalk.bold(chalk.green.bold("> ") + chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(" Setting permissions for slash commands (/)... Please wait"));
await fetch(`https://discordapp.com/api/v9/applications/${client.config.id}/commands`, {
method: "GET",
headers: {
authorization: `Bot ${client.token}`,
},
})
.then((res) => res.json())
.then((body) => {
if (body) {
body.forEach((obj) => {
if (obj.default_permission != true) {
const cmd = client.slash_commands.get(obj.name);
client.application.commands.permissions.add({ command: obj.id, permissions: cmd.permissions, guild: client.config.support_server_id });
}
});
}
});

//console.log(chalk.bold(chalk.green.bold("> ") + chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(" Setting permissions for slash commands (/) done!"));
console.log(chalk.bold(chalk.green.bold("> ") + chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(" Successfully registered " + chalk.blue.underline(`${client.slash_commands.size}`) + " (total: " + chalk.blue.underline(client.all_commands) + ") slash commands! (/)"));
};

0 comments on commit 2832517

Please sign in to comment.