Skip to content

Commit

Permalink
feat(debug): added debug command & enhanced server command
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerotask committed Apr 24, 2021
1 parent ed2e068 commit b7b0e43
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
5 changes: 4 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
},
"roles": {
"mod": "803005364366213171"
}
},
"developers": [
"209292814599716865"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-bot-goldi",
"version": "1.1.1",
"version": "1.1.2",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -26,4 +26,4 @@
"nodemon": "^2.0.7",
"openode": "^2.1.0"
}
}
}
29 changes: 29 additions & 0 deletions src/commands/debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const { isDeveloper } = require('../functions');

module.exports = {
name: 'debug',
aliases: ['dev'],
description: 'Debug-Informationen über den Server',
execute(message, args, client) {
if (isDeveloper(message.author.id)) {
let response = [];
response.push('**MESSAGE OBJECT:**');
response.push(JSON.stringify(message));
response.push('');
message.channel.send(response);

response = [];
response.push('**AUTHOR OBJECT:**');
response.push(JSON.stringify(message.author));
response.push('');
message.channel.send(response);

response = [];
response.push('**CLIENT OBJECT:**');
response.push(JSON.stringify(client));
message.channel.send(response);
} else {
message.reply('Du musst ein Entwickler sein, um diesen Befehl auszuführen.');
}
},
};
5 changes: 4 additions & 1 deletion src/commands/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ module.exports = {
const totalOnline = fetchedMembers.filter((member) => member.presence.status === 'online');

const response = [];
response.push(`Name: ${guild.name}`);
response.push(`Name: ${guild.name} (ID: ${guild.id})`);
response.push(`Anzahl User: ${guild.memberCount} | davon gerade online: ${totalOnline.size}`);
response.push(`Anzahl Channels: ${guild.channels.cache.size}`);
response.push(`Anzahl Rollen: ${guild.roles.cache.size}`);
response.push(`Sprache: ${guild.preferredLocale}`);
response.push(`Region: ${guild.region}`);
response.push(`Features: ${guild.features.join(', ')}`);
response.push(`Premium Tier: ${guild.premiumTier} (${guild.premiumSubscriptionCount})`);
message.channel.send(response);
});
},
Expand Down
2 changes: 2 additions & 0 deletions src/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const shuffleArray = (array) => {
};

const isMod = (member) => member.roles.cache.some((role) => role.name === 'Mod' || role.name === 'Admin' || role.name === 'Goldman94');
const isDeveloper = (userId) => config.developers.includes(userId);

const reactToEmojis = (message) => {
const lowerCaseContent = message.content.toLowerCase();
Expand Down Expand Up @@ -89,6 +90,7 @@ module.exports = {
getUserFromMention,
shuffleArray,
isMod,
isDeveloper,
reactToEmojis,
reactToCommands,
reactToMessages,
Expand Down

0 comments on commit b7b0e43

Please sign in to comment.