From d70bd167973b5171dbe82bac2daba04e73602bfa Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sat, 14 Mar 2020 22:03:31 -0500 Subject: Add queue clear command --- src/commands/clear.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/commands/clear.ts (limited to 'src/commands') 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 { + this.queue.clear(msg.guild!.id); + + await msg.channel.send('cleared'); + } +} -- cgit v1.2.3