aboutsummaryrefslogtreecommitdiff
path: root/src/commands/dev
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/dev')
-rw-r--r--src/commands/dev/_testDuration.ts53
-rw-r--r--src/commands/dev/say.ts58
-rw-r--r--src/commands/dev/setLevel.ts6
-rw-r--r--src/commands/dev/testDuration.ts53
4 files changed, 114 insertions, 56 deletions
diff --git a/src/commands/dev/_testDuration.ts b/src/commands/dev/_testDuration.ts
new file mode 100644
index 0000000..3ad9aff
--- /dev/null
+++ b/src/commands/dev/_testDuration.ts
@@ -0,0 +1,53 @@
+// import { BushCommand, BushSlashMessage } from '@lib';
+// import { stripIndents } from 'common-tags';
+// import { Message } from 'discord.js';
+
+// export default class TestDurationCommand extends BushCommand {
+// public constructor() {
+// super('testduration', {
+// aliases: ['testduration'],
+// category: 'dev',
+// description: {
+// content: 'Tests duration parsing.',
+// usage: 'testduration [reason]',
+// examples: ['testduration']
+// },
+// args: [
+// {
+// id: 'reason',
+// type: 'contentWithDuration',
+// match: 'rest',
+// prompt: {
+// start: 'Enter text and a duration here.',
+// retry: '{error} Error parsing duration and text.',
+// optional: true
+// }
+// }
+// ],
+// slash: true,
+// slashOptions: [
+// {
+// name: 'reason',
+// description: 'Enter text and a duration here.',
+// type: 'STRING',
+// required: false
+// }
+// ],
+// hidden: true,
+// ownerOnly: true
+// });
+// }
+
+// async exec(
+// message: Message | BushSlashMessage,
+// { reason }: { reason?: { duration: number; contentWithoutTime: string } }
+// ): Promise<unknown> {
+// const rawDuration = reason.duration;
+// const text = reason.contentWithoutTime;
+// const humanizedDuration = this.client.util.humanizeDuration(rawDuration);
+// return await message.util.reply(stripIndents`
+// **rawDuration:** ${rawDuration}
+// **text:** ${text}
+// **humanizedDuration:** ${humanizedDuration}`);
+// }
+// }
diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts
new file mode 100644
index 0000000..9dc2632
--- /dev/null
+++ b/src/commands/dev/say.ts
@@ -0,0 +1,58 @@
+import { AllowedMentions, BushCommand, BushMessage } from '@lib';
+import { AkairoMessage } from 'discord-akairo';
+
+export default class SayCommand extends BushCommand {
+ public constructor() {
+ super('say', {
+ aliases: ['say'],
+ category: 'dev',
+ description: {
+ content: 'A command make the bot say something.',
+ usage: 'say <message>',
+ examples: ['say hello']
+ },
+ args: [
+ {
+ id: 'say',
+ type: 'string',
+ match: 'rest',
+ prompt: {
+ start: 'What would you like the bot to say?',
+ retry: '{error} Choose something valid to say.'
+ }
+ }
+ ],
+ slashOptions: [
+ {
+ name: 'content',
+ description: 'What would you like the bot to say?',
+ type: 'STRING'
+ }
+ ],
+ ownerOnly: true,
+ clientPermissions: ['SEND_MESSAGES'],
+ slash: true
+ });
+ }
+
+ public async exec(message: BushMessage, { say }: { say: string }): Promise<unknown> {
+ if (!message.author.isOwner())
+ return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`);
+
+ if (message.deletable) {
+ await message.delete();
+ }
+ await message.util.send({ content: say, allowedMentions: AllowedMentions.none() });
+ }
+
+ public async execSlash(message: AkairoMessage, { content }: { content: string }): Promise<unknown> {
+ if (!this.client.config.owners.includes(message.author.id)) {
+ return await message.interaction.reply({
+ content: `${this.client.util.emojis.error} Only my developers can run this command.`,
+ ephemeral: true
+ });
+ }
+ await message.interaction.reply({ content: 'Attempting to send message.', ephemeral: true });
+ return message.channel.send({ content, allowedMentions: AllowedMentions.none() });
+ }
+}
diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts
index db0cfab..f2ae6c7 100644
--- a/src/commands/dev/setLevel.ts
+++ b/src/commands/dev/setLevel.ts
@@ -29,21 +29,21 @@ export default class SetLevelCommand extends BushCommand {
}
}
],
- ownerOnly: true,
slashOptions: [
{
name: 'user',
- description: 'The user to change the level of',
+ description: 'What user would you like to change the level of?',
type: 'USER',
required: true
},
{
name: 'level',
- description: 'The level to set the user to',
+ description: 'What level would you like to set the user to?',
type: 'INTEGER',
required: true
}
],
+ ownerOnly: true,
slash: true
});
}
diff --git a/src/commands/dev/testDuration.ts b/src/commands/dev/testDuration.ts
deleted file mode 100644
index 2d636d2..0000000
--- a/src/commands/dev/testDuration.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { BushCommand, BushSlashMessage } from '@lib';
-import { stripIndents } from 'common-tags';
-import { Message } from 'discord.js';
-
-export default class TestDurationCommand extends BushCommand {
- public constructor() {
- super('testduration', {
- aliases: ['testduration'],
- category: 'dev',
- description: {
- content: 'Tests duration parsing.',
- usage: 'testduration [reason]',
- examples: ['testduration']
- },
- args: [
- {
- id: 'reason',
- type: 'contentWithDuration',
- match: 'rest',
- prompt: {
- start: 'Enter text and a duration here.',
- retry: '{error} Error parsing duration and text.',
- optional: true
- }
- }
- ],
- slash: true,
- slashOptions: [
- {
- name: 'reason',
- description: 'Enter text and a duration here.',
- type: 'STRING',
- required: false
- }
- ],
- hidden: true,
- ownerOnly: true
- });
- }
-
- async exec(
- message: Message | BushSlashMessage,
- { reason }: { reason?: { duration: number; contentWithoutTime: string } }
- ): Promise<unknown> {
- const rawDuration = reason.duration;
- const text = reason.contentWithoutTime;
- const humanizedDuration = this.client.util.humanizeDuration(rawDuration);
- return await message.util.reply(stripIndents`
- **rawDuration:** ${rawDuration}
- **text:** ${text}
- **humanizedDuration:** ${humanizedDuration}`);
- }
-}