From 883f021974a6b86bf487051b6b71af81161a1404 Mon Sep 17 00:00:00 2001 From: Yann Date: Sat, 1 May 2021 05:26:08 -0300 Subject: [PATCH] Update 0.5 --- src/events/index.ts | 10 ++++++++++ src/events/voice/index.ts | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/events/index.ts b/src/events/index.ts index d8d2508..1473839 100644 --- a/src/events/index.ts +++ b/src/events/index.ts @@ -71,6 +71,16 @@ export default class Events { this.voice.shuffleCommand(message); } + @Command('stop') + private stopCommand(message: CommandMessage){ + this.voice.stopCommand(message) + } + + @Command('loop') + private loopCommand(message: CommandMessage){ + this.voice.loopCommand(message) + } + //-------------------------- MESSAGE -------------------------- diff --git a/src/events/voice/index.ts b/src/events/voice/index.ts index 782814b..b9fff90 100644 --- a/src/events/voice/index.ts +++ b/src/events/voice/index.ts @@ -2,6 +2,8 @@ import config from 'config'; import { StreamDispatcher, VoiceConnection } from "discord.js"; import { CommandMessage, CommandNotFound, Client } from "@typeit/discord"; import { StreamTransportOptions } from 'winston/lib/winston/transports'; +import { monitorEventLoopDelay } from 'node:perf_hooks'; +import { repeat } from 'lodash'; const ytdl = require('ytdl-core'); export default class Voice { @@ -53,6 +55,13 @@ export default class Voice { } } + public stopCommand(message: CommandMessage){ + if (!this.whitelist[message.channel.id]) return; + this.player?.dispatcher.end(); + this.clearQueueTool(); + message.reply(`Parei de tocar? Bota outro som ae :D`) + } + public shuffleCommand(message: CommandMessage){ if (!this.whitelist[message.channel.id]) return; this.queue = this.shuffle(this.queue); @@ -89,6 +98,12 @@ export default class Voice { // to@do } + public loopCommand(message: CommandMessage){ + if (!this.whitelist[message.channel.id]) return; + //to@do + } + + public volumeCommand(message: CommandMessage) { if (!this.whitelist[message.channel.id]) return; let bool: any = message.args.value > 100 ? ((message.args.value = 100) / 100) : (message.args.value / 100);