From 98af8a31a10dd42f4a015f1853be4bab5781df42 Mon Sep 17 00:00:00 2001 From: Noah Struck Date: Thu, 22 Feb 2024 17:02:11 -0500 Subject: [PATCH] Removed VoiceStateManagement responses from voice.ts --- src/lib/voice.ts | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/lib/voice.ts b/src/lib/voice.ts index d6e13d3..d633512 100644 --- a/src/lib/voice.ts +++ b/src/lib/voice.ts @@ -1,4 +1,4 @@ -import { AudioPlayer, AudioPlayerStatus, AudioResource, createAudioPlayer, createAudioResource, demuxProbe, getVoiceConnection, joinVoiceChannel } from "@discordjs/voice"; +import { AudioPlayer, AudioPlayerStatus, AudioResource, createAudioPlayer, createAudioResource, getVoiceConnection, joinVoiceChannel } from "@discordjs/voice"; import { VoiceBasedChannel } from "discord.js"; import { voiceManager, ytdl } from "../app"; import { YoutubeMetadata } from "./utils/youtube"; @@ -110,7 +110,7 @@ export class VoiceConnection { disconnect = () => { let voiceConnection = this.get(); - if (!voiceConnection) return { type: VoiceConnectionStatusType.FAIL, message: "Not connected to a voice channel!"}; + if (!voiceConnection) return; console.log(`[GUILD ${this.guildId}] [VC ${this.channelId}] DISCONNECTED - Disconnected from voice (probably due to inactivity)`) @@ -127,35 +127,17 @@ export class VoiceConnection { if (this.timeout) clearInterval(this.timeout); voiceManager.destroy(this.guildId); - - return { type: VoiceConnectionStatusType.SUCCESS, message: "Disconnected from voice."}; } next = () => { this.playing = this.queue.shift(); if (!this.playing) { this.timeout = setInterval(() => this.disconnect(), 1000 * 60 * 5); - return { type: VoiceConnectionStatusType.FAIL, message: "There isn't a next song in the queue." }; + return; } this.load(this.playing.getUrl()); if (this.timeout) clearTimeout(this.timeout); - - return { type: VoiceConnectionStatusType.SUCCESS, message: `Playing \`${this.playing.getTitle()} - ${this.playing.getAuthor()}\`` }; } -} - -export interface VoiceConnectionStatus { - type: VoiceConnectionStatusType; - message: string; - metadata?: YoutubeMetadata; - time?: string; -} - -export enum VoiceConnectionStatusType { - - SUCCESS = 1, - FAIL = 0 - } \ No newline at end of file