aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-14 22:03:31 -0500
committerMax Isom <[email protected]>2020-03-14 22:03:31 -0500
commitd70bd167973b5171dbe82bac2daba04e73602bfa (patch)
tree885f1a1b992cfea6002763742af7311f665a0a1f /src/commands
parent9e1d656e520b88a9c88f3ac6ebfd73843cc821f1 (diff)
downloadmuse-d70bd167973b5171dbe82bac2daba04e73602bfa.tar.xz
muse-d70bd167973b5171dbe82bac2daba04e73602bfa.zip
Add queue clear command
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/clear.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/commands/clear.ts b/src/commands/clear.ts
new file mode 100644
index 0000000..98f7b7f
--- /dev/null
+++ b/src/commands/clear.ts
@@ -0,0 +1,22 @@
+import {Message} from 'discord.js';
+import {TYPES} from '../types';
+import {inject, injectable} from 'inversify';
+import Queue from '../services/queue';
+import Command from '.';
+
+@injectable()
+export default class implements Command {
+ public name = 'clear';
+ public description = 'clears all songs in queue (except currently playing)';
+ private readonly queue: Queue;
+
+ constructor(@inject(TYPES.Services.Queue) queue: Queue) {
+ this.queue = queue;
+ }
+
+ public async execute(msg: Message, _: string []): Promise<void> {
+ this.queue.clear(msg.guild!.id);
+
+ await msg.channel.send('cleared');
+ }
+}