Skip to content

Commit

Permalink
Refacor: make all command unavailable for dms
Browse files Browse the repository at this point in the history
  • Loading branch information
Ballaual committed May 15, 2023
1 parent 7b0336c commit 98dc947
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 18 deletions.
5 changes: 3 additions & 2 deletions commands/misc/donate.js → commands/information/donate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const { donate } = require('../../config.json');
module.exports = {
data: new SlashCommandBuilder()
.setName('donate')
.setDescription('Displays the donation link'),
category: 'misc',
.setDescription('Displays the donation link')
.setDMPermission(false),
category: 'information',
async execute(interaction) {
if (!donate) {
return interaction.reply({ content: 'Missing `donate` parameter in config.json', ephemeral: true });
Expand Down
5 changes: 3 additions & 2 deletions commands/misc/github.js → commands/information/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const { github } = require('../../config.json');
module.exports = {
data: new SlashCommandBuilder()
.setName('github')
.setDescription('Displays the link to the public github repository of the bot'),
category: 'misc',
.setDescription('Displays the link to the public github repository of the bot')
.setDMPermission(false),
category: 'information',
async execute(interaction) {
if (!github) {
return interaction.reply({ content: 'Missing `githubLink` parameter in config.json', ephemeral: true });
Expand Down
5 changes: 3 additions & 2 deletions commands/misc/guilds.js → commands/information/guilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('guilds')
.setDescription('Displays the top 50 guilds the bot is in'),
category: 'misc',
.setDescription('Displays the top 50 guilds the bot is in')
.setDMPermission(false),
category: 'information',
async execute(interaction) {
const guilds = interaction.client.guilds.cache
.sort((a, b) => b.memberCount - a.memberCount)
Expand Down
5 changes: 3 additions & 2 deletions commands/util/info.js → commands/information/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const { ownerId } = require('../../config.json');
module.exports = {
data: new SlashCommandBuilder()
.setName('info')
.setDescription('Displays detailed information about the bot'),
category: 'util',
.setDescription('Displays detailed information about the bot')
.setDMPermission(false),
category: 'information',
async execute(interaction) {
const client = interaction.client;
const embed = new EmbedBuilder()
Expand Down
1 change: 1 addition & 0 deletions commands/moderation/nickname.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
data: new SlashCommandBuilder()
.setName('nickname')
.setDescription('Change the nickname of a user')
.setDMPermission(false)
.addUserOption(option => option
.setName('target')
.setDescription('The user to change the nickname for')
Expand Down
5 changes: 3 additions & 2 deletions commands/misc/invite.js → commands/util/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const { invite } = require('../../config.json');
module.exports = {
data: new SlashCommandBuilder()
.setName('invite')
.setDescription('Displays the invite link of the bot'),
category: 'misc',
.setDescription('Displays the invite link of the bot')
.setDMPermission(false),
category: 'util',
async execute(interaction) {
if (!invite) {
return interaction.reply({ content: 'Missing `invite` parameter in config.json', ephemeral: true });
Expand Down
5 changes: 3 additions & 2 deletions commands/misc/ping.js → commands/util/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ module.exports = {
cooldown: 10,
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Returns latency and API ping'),
category: 'misc',
.setDescription('Returns latency and API ping')
.setDMPermission(false),
category: 'util',
async execute(interaction) {
const embed = new EmbedBuilder()
.setColor('#FF0000')
Expand Down
5 changes: 3 additions & 2 deletions commands/misc/uptime.js → commands/util/uptime.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('uptime')
.setDescription('Displays the bots uptime'),
category: 'misc',
.setDescription('Displays the bots uptime')
.setDMPermission(false),
category: 'util',
async execute(interaction) {
const days = Math.floor(interaction.client.uptime / 86400000);
const hours = Math.floor(interaction.client.uptime / 3600000) % 24;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DiCoBo",
"version": "2.0.5",
"version": "2.0.6",
"description": "a discordbot written in discord.js v14 using (/) commands",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.0.5",
"version": "2.0.6",
"note": "DO NOT EDIT this file, unless you know what you are doing here!"
}

0 comments on commit 98dc947

Please sign in to comment.