Make owner commands cleaner

This commit is contained in:
Dragon Fire
2024-04-26 23:47:58 -04:00
parent 88aa793d99
commit 085546e0cf
7 changed files with 12 additions and 41 deletions
-29
View File
@@ -1,29 +0,0 @@
const Command = require('../../framework/Command');
const { DataResolver, Routes } = require('discord.js');
module.exports = class BannerCommand extends Command {
constructor(client) {
super(client, {
name: 'banner',
group: 'util',
memberName: 'banner',
description: 'Sets the bot\'s banner.',
details: 'Only the bot owner(s) may use this command.',
ownerOnly: true,
guarded: true,
args: [
{
key: 'image',
type: 'image'
}
]
});
}
async run(msg, { image }) {
await this.client.rest.patch(Routes.user(), {
body: { banner: await DataResolver.resolveImage(image) }
});
return msg.say('Set the banner.');
}
};
+2 -2
View File
@@ -30,7 +30,7 @@ module.exports = class CommandLastRunExportCommand extends Command {
async run(msg) {
const result = this.client.exportLastRun();
await msg.direct({ files: [{ attachment: result, name: 'command-last-run.json' }] });
return msg.say('📬 Sent `command-last-run.json` to your DMs!');
if (msg.guild) await msg.say('📬 Sent `command-last-run.json` to your DMs!');
return msg.direct({ files: [{ attachment: result, name: 'command-last-run.json' }] });
}
};
+2 -2
View File
@@ -24,7 +24,7 @@ module.exports = class CommandLeaderboardExportCommand extends Command {
async run(msg) {
const result = this.client.exportCommandLeaderboard();
await msg.direct({ files: [{ attachment: result, name: 'command-leaderboard.json' }] });
return msg.say('📬 Sent `command-leaderboard.json` to your DMs!');
if (msg.guild) await msg.say('📬 Sent `command-leaderboard.json` to your DMs!');
return msg.direct({ files: [{ attachment: result, name: 'command-leaderboard.json' }] });
}
};
+2 -2
View File
@@ -29,7 +29,7 @@ module.exports = class GenerateCommandsCommand extends Command {
})
.filter(cmds => cmds);
const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}`;
await msg.direct({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
return msg.say('📬 Sent `commands.txt` to your DMs!');
if (msg.guild) await msg.say('📬 Sent `commands.txt` to your DMs!');
return msg.direct({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
}
};
+2 -2
View File
@@ -36,7 +36,7 @@ module.exports = class GenerateCreditCommand extends Command {
})
.filter(cmds => cmds);
const file = Buffer.from(`## Credits\n### NPM Packages\n${npm}\n\n### Other Credits\n${list.join('\n')}`);
await msg.direct({ files: [{ attachment: file, name: 'credits.txt' }] });
return msg.say('📬 Sent `credits.txt` to your DMs!');
if (msg.guild) await msg.say('📬 Sent `credits.txt` to your DMs!');
return msg.direct({ files: [{ attachment: file, name: 'credits.txt' }] });
}
};
+2 -2
View File
@@ -24,7 +24,7 @@ module.exports = class GenerateProcessEnvCommand extends Command {
line = line.replace('=', '');
return `${line}="${process.env[line] || ''}"`;
}).join('\n');
await msg.direct({ files: [{ attachment: Buffer.from(list), name: 'process.env.txt' }] });
return msg.say('📬 Sent `process.env.txt` to your DMs!');
if (msg.guild) await msg.say('📬 Sent `process.env.txt` to your DMs!');
return msg.direct({ files: [{ attachment: Buffer.from(list), name: 'process.env.txt' }] });
}
};
+2 -2
View File
@@ -25,7 +25,7 @@ module.exports = class IpCommand extends Command {
const { body } = await request
.get('https://api.ipify.org/')
.query({ format: 'json' });
await msg.direct(body.ip);
return msg.say('📬 Sent the IP to your DMs!');
if (msg.guild) await msg.say('📬 Sent the IP to your DMs!');
return msg.direct(body.ip);
}
};