Skip to content

Commit

Permalink
better Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
CSP02 committed Dec 18, 2021
1 parent 3764c1c commit 3003f87
Show file tree
Hide file tree
Showing 30 changed files with 125 additions and 161 deletions.
11 changes: 8 additions & 3 deletions SlashCommands/slashPing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data:new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with pong!')
name: 'ping',
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with pong!'),

async execute(client, interaction, Discord) {
interaction.reply(`Present heart beat of the bot is ${client.ws.ping}ms.`);
}
}
11 changes: 8 additions & 3 deletions SlashCommands/slashPrefix.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data:new SlashCommandBuilder()
.setName('prefix')
.setDescription('Replies with prefix of this bot.')
name: 'prefix',
data: new SlashCommandBuilder()
.setName('prefix')
.setDescription('Replies with prefix of this bot.'),

async execute(client, interaction, Discord) {
interaction.reply(`prefix of this bot is \`\`\`!\`\`\``);
}
}
7 changes: 0 additions & 7 deletions SlashInteractions/ping.js

This file was deleted.

7 changes: 0 additions & 7 deletions SlashInteractions/prefix.js

This file was deleted.

6 changes: 1 addition & 5 deletions commands/Moderation/ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ module.exports = {
message.channel.send('cant find that member');
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ module.exports = {
});
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/deleteInfractions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ module.exports = {
if (athr == '') return message.channel.send("No warn/mute/ban was found for the given infraction ID.")
else return message.channel.send({ embeds: [embdmsg] })
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/infraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ module.exports = {
}
})
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/kick.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ module.exports = {
message.channel.send('cant find that member');
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/mute.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ module.exports = {
message.reply('you have no permission');
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ module.exports = {
}
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/unban.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ module.exports = {
sLogsChannel.send({ embeds: [embedMsg] })
})
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/unmute.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ module.exports = {
message.reply('you have no permission');
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Moderation/warn.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ module.exports = {
}
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Utility/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ module.exports = {
return message.channel.send({ embeds: [embedMsg] });

} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Utility/removerole.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ module.exports = {
message.channel.send("Spedify a role to remove.")
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Utility/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ module.exports = {
message.channel.send({ embeds: [embdMsg] });
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Utility/serverinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ module.exports = {
{ name: 'Channel Count:', value: `${message.guild.channels.channelCountWithoutThreads}` })
message.channel.send({ embeds: [embedMsg] })
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/Utility/userinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ module.exports = {
)
message.channel.send({ embeds: [embMsg] });
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/fun/bam.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ module.exports = {
message.channel.send({ embeds: [embedMsg] });
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/fun/emote.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ module.exports = {
}
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/fun/givepoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ module.exports = {
})
message.channel.send({ embeds: [embedMsg] })
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/fun/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ module.exports = {
message.channel.send(e.message)
}
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/fun/points.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ module.exports = {
}
})
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/jam_info/jamInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ module.exports = {
}
})
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/jam_info/setJamInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ module.exports = {

message.channel.send({ embeds: [embedMsg] })
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
6 changes: 1 addition & 5 deletions commands/soft_moderation/pinnedmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ module.exports = {
}
})
} catch (e) {
const emd = new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle('command raised an error in the source code:')
.setDescription(`\`\`\`${e}\`\`\`\n\nYou can crease a issue report here https://github.com/Chandra-sekhar-pilla/The-Bot-v2.0.0`)
message.channel.send({ embeds: [emd] })
require(`../../handlers/ErrorHandler.js`)(client, message, Discord, e, this.name)
}
}
}
Loading

0 comments on commit 3003f87

Please sign in to comment.