Gotowka / mydbm

MIT License
2 stars 3 forks source link

Bot stops playing music after 20 seconds! #4

Closed supertrio17 closed 1 year ago

supertrio17 commented 1 year ago

Hey, it started working now, bot plays music, but it stops playing after 20 seconds of a song, and then it just stops and disconnects.

When trying to use command again it wont play music, I need to restart the bot and then it starts working for another 20 second.

There is no error in console.

supertrio17 commented 1 year ago

For how i got it to work, i used https://github.com/Gotowka/autorskieakcje files

Gotowka commented 1 year ago

And it work now?

supertrio17 commented 1 year ago

It does play music, but like I said, it stops after 20-30 seconds of playing.

Gotowka commented 1 year ago

Sorry but I can't fix it but, DBM must by update to new version of djs

supertrio17 commented 1 year ago

And it stopped working again, same error

Bot is ready! D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:94 if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED'); ^

Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred. at CommandInteraction.reply (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:94:46) at D:\Projekti\DBM\Pink Panter Moderator\actions\play_all.js:147:26 {

}

Node.js v18.13.0

supertrio17 commented 1 year ago

It stops working for no reason, I didnt open dbm, just started it from command line again

supertrio17 commented 1 year ago

@Gotowka i found the solution for this problem, but I think its a major bug and should be fixed. Every time I get this error, I change name of the slash parameter, for example song, when I get this error, then I just change it to song2 or something an it works.

image

I got the idea from this discussion on github https://github.com/discordjs/guide/discussions/897.

But thats a fix for Error [INTERACTION_ALREADY_REPLIED], it still stops playing music after 20 seconds or so.

Gotowka commented 1 year ago

I change it for the mod code and you can look if it work

Gotowka commented 1 year ago

https://github.com/Gotowka/mydbm/commit/b55a3c9a35c310aa7b15e9beb7a8f5b563046191

supertrio17 commented 1 year ago

Application does not respond image This is error output!

Bot is ready! Error: Cannot destroy VoiceConnection - it has already been destroyed at G.destroy (D:\Projekti\DBM\Pink Panter Moderator\node_modules\@discordjs\voice\dist\index.js:8:10564) at VoiceUtils. (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord-player\dist\VoiceInterface\VoiceUtils.js:59:22) at Generator.throw () at rejected (D:\Projekti\DBM\Pink Panter Moderator\node_modules\tslib\tslib.js:165:69) Error with the Command "play" - Action #2 (Send Message): DiscordAPIError: Unknown interaction at RequestHandler.execute (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async CommandInteraction.reply (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:103:5) <ref 1> Queue { tracks: [], previousTracks: [ Track { id: '1086742301151199233', title: 'Medenjaci - Medena - (Audio 2006)', author: 'Grand Production', url: 'https://www.youtube.com/watch?v=vO9pgvv7qgg', thumbnail: 'https://i3.ytimg.com/vi/vO9pgvv7qgg/maxresdefault.jpg', duration: '3:59', views: 2503408, requestedBy: [User], playlist: undefined } ], playing: false, metadata: undefined, repeatMode: 0, id: '1086742210722004992', _streamTime: 0, _cooldownsTimeout: Collection(0) [Map] {}, _activeFilters: [], _filtersUpdate: undefined, onBeforeCreateStream: null, player: Player { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, options: { autoRegisterExtractor: true, ytdlOptions: [Object], connectionTimeout: 20000 }, queues: Collection(1) [Map] { '1083049125920133200' => [Circular 1] }, voiceUtils: VoiceUtils { cache: [Collection [Map]] }, extractors: Collection(0) [Map] {}, requiredEvents: [ 'error', 'connectionError' ], client: Client { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, options: [Object], rest: [RESTManager], _cleanups: [Set], _finalizers: FinalizationRegistry {}, ws: [WebSocketManager], actions: [ActionsManager], voice: [ClientVoiceManager], shard: null, users: UserManager {}, guilds: GuildManager {}, channels: ChannelManager {}, sweepers: [Sweepers], presence: [ClientPresence], user: null, application: null, readyAt: null,

},
[Symbol(kCapture)]: false

}, guild: <ref 2> Guild { id: '1083049125920133200', name: 'Pink Panteri', icon: '2467419305c05d72eb077933d94d4716', features: [], commands: GuildApplicationCommandManager { permissions: [ApplicationCommandPermissionsManager], guild: [Circular 2] }, members: GuildMemberManager { guild: [Circular 2] }, channels: GuildChannelManager { guild: [Circular 2] }, bans: GuildBanManager { guild: [Circular 2] }, roles: RoleManager { guild: [Circular 2] }, presences: PresenceManager {}, voiceStates: VoiceStateManager { guild: [Circular 2] }, stageInstances: StageInstanceManager { guild: [Circular 2] }, invites: GuildInviteManager { guild: [Circular 2] }, scheduledEvents: GuildScheduledEventManager { guild: [Circular 2] }, available: true, shardId: 0, splash: null, banner: null, description: null, verificationLevel: 'NONE', vanityURLCode: null, nsfwLevel: 'DEFAULT', premiumSubscriptionCount: 0, discoverySplash: null, memberCount: 11, large: false, premiumProgressBarEnabled: false, applicationId: null, afkTimeout: 1800, afkChannelId: '1083233919027122247', systemChannelId: '1083049126368919702', premiumTier: 'NONE', explicitContentFilter: 'DISABLED', mfaLevel: 'NONE', joinedTimestamp: 1678333981031, defaultMessageNotifications: 'ALL_MESSAGES', systemChannelFlags: SystemChannelFlags { bitfield: 15 }, maximumMembers: 500000, maximumPresences: null, approximateMemberCount: null, approximatePresenceCount: null, vanityURLUses: null, rulesChannelId: null, publicUpdatesChannelId: null, preferredLocale: 'en-US', ownerId: '266492206846574612', emojis: GuildEmojiManager { guild: [Circular 2] }, stickers: GuildStickerManager { guild: [Circular 2] } }, options: { leaveOnEnd: true, leaveOnStop: true, leaveOnEmpty: true, leaveOnEmptyCooldown: 1000, autoSelfDeaf: true, ytdlOptions: { quality: 'highestaudio', highWaterMark: 33554432 }, initialVolume: 100, bufferingTimeout: 3000, spotifyBridge: true, disableVolume: false, volumeSmoothness: 0.08 }, connection: StreamDispatcher { _events: [Object: null prototype] { error: [Function (anonymous)], debug: [Function (anonymous)], start: [Function (anonymous)], finish: [Function (anonymous)] }, _eventsCount: 4, _maxListeners: undefined, connectionTimeout: 20000, readyLock: false, voiceConnection: G { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, rejoinAttempts: 0, _state: [Object], joinConfig: [Object], packets: [Object], receiver: [j], debug: null, onNetworkingClose: [Function: bound onNetworkingClose], onNetworkingStateChange: [Function: bound onNetworkingStateChange], onNetworkingError: [Function: bound onNetworkingError], onNetworkingDebug: [Function: bound onNetworkingDebug],

},
audioPlayer: B {
  _events: [Object: null prototype],
  _eventsCount: 3,
  _maxListeners: undefined,
  _state: [Object],
  subscribers: [],
  behaviors: [Object],
  debug: [Function (anonymous)],
  [Symbol(kCapture)]: false
},
channel: VoiceChannel {
  type: 'GUILD_VOICE',
  guild: [Guild],
  guildId: '1083049125920133200',
  parentId: '1083049126368919706',
  permissionOverwrites: [PermissionOverwriteManager],
  id: '1083049126368919711',
  name: '𝕃𝕠𝕓𝕓𝕪 #𝟚'      ,
  rawPosition: 1,
  rtcRegion: null,
  bitrate: 64000,
  userLimit: 5,
  videoQualityMode: null
},
paused: false,
audioResource: T {
  playStream: [Encoder],
  edges: [Array],
  metadata: [Track],
  volume: [VolumeTransformer],
  encoder: [Encoder],
  audioPlayer: undefined,
  playbackDuration: 0,
  started: true,
  silencePaddingFrames: 5,
  silenceRemaining: -1
},
[Symbol(kCapture)]: false

} } AbortError: The operation was aborted at EventTarget.abortListener (node:events:958:14) at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20) at EventTarget.dispatchEvent (node:internal/event_target:677:26) at abortSignal (node:internal/abort_controller:308:10) at AbortController.abort (node:internal/abort_controller:338:5) at Timeout. (D:\Projekti\DBM\Pink Panter Moderator\node_modules\@discordjs\voice\dist\index.js:9:64) at listOnTimeout (node:internal/timers:564:17) at process.processTimers (node:internal/timers:507:7) { code: 'ABORT_ERR', [cause]: DOMException [AbortError]: This operation was aborted at new DOMException (node:internal/per_context/domexception:53:5) at AbortController.abort (node:internal/abort_controller:336:18) at Timeout. (D:\Projekti\DBM\Pink Panter Moderator\node_modules\@discordjs\voice\dist\index.js:9:64) at listOnTimeout (node:internal/timers:564:17) at process.processTimers (node:internal/timers:507:7) } (node:19404) Warning: [DiscordPlayerWarning] Unhandled "connectionError" event! Events "error", "connectionError" must have event listeners! (Use node --trace-warnings ... to show where the warning was created)

supertrio17 commented 1 year ago

I downloaded your actions from https://github.com/Gotowka/autorskieakcje, and replaced interaction.reply with interaction.followUp, and it works, seems like new version from mydbm has some problems with it

PS: But it still stops playing after 20 seconds

supertrio17 commented 1 year ago

@Gotowka Okay, now I get this error:

Bot is ready! Error: Cannot destroy VoiceConnection - it has already been destroyed at G.destroy (D:\Projekti\DBM\Pink Panter Moderator\node_modules\@discordjs\voice\dist\index.js:8:10564) at VoiceUtils. (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord-player\dist\VoiceInterface\VoiceUtils.js:59:22) at Generator.throw () at rejected (D:\Projekti\DBM\Pink Panter Moderator\node_modules\tslib\tslib.js:165:69) Error with the Command "play" - Action #2 (Send Message): DiscordAPIError: Unknown interaction at RequestHandler.execute (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async CommandInteraction.reply (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:103:5)

I found some links that might be helpful, for what I'm understanding its happening because there needs to be await interaction.reply before replying.

https://stackoverflow.com/questions/67413046/slash-commands-unknown-interaction https://github.com/discordjs/discord.js/issues/7005

supertrio17 commented 1 year ago

By debbuging a little bit, I found out that this is where code stops being executed: if (!queue.connection) queue.connect(interaction.member.voice.channel).catch(async (err) => { queue.destroy() return interaction.reply({ content: 'Ponovi komandu!'}) }) So I'm guessing that it catches an error and thats why its not working?

supertrio17 commented 1 year ago

As for the error im getting, by using debugging i got to this!

D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord-player\node_modules\@discordjs\voice\dist\index.js:8 to ${ve(e)})}play(e){if(e.ended)throw new Error("Cannot play a resource that has already ended.");if(e.audioPlayer){if(e.audioPlayer===this)return;throw new Error("Resource is already being played by another audio player.")}e.audioPlayer=this;let t=o=>{this.state.status!=="idle"&&this.emit("error",new R(o,this.state.resource)),this.state.status!=="idle"&&this.state.resource===e&&(this.state={status:"idle"})};if(e.playStream.once("error",t),e.started)this.state={status:"playing",missedFrames:0,playbackDuration:0,resource:e,onStreamError:t};else{let o=()=>{this.state.status==="buffering"&&this.state.resource===e&&(this.state={status:"playing",missedFrames:0,playbackDuration:0,resource:e,onStreamError:t})},s=()=>{this.state.status==="buffering"&&this.state.resource===e&&(this.state={status:"idle"})};e.playStream.once("readable",o),e.playStream.once("end",s),e.playStream.once("close",s),e.playStream.once("finish",s),this.state={status:"buffering",resource:e,onReadableCallback:o,onFailureCallback:s,onStreamError:t}}}pause(e=!0){return this.state.status!=="playing"?!1:(this.state={...this.state,status:"paused",silencePacketsRemaining:e?5:0},!0)}unpause(){return this.state.status!=="paused"?!1:(this.state={...this.state,status:"playing",missedFrames:0},!0)}stop(e=!1){return this.state.status==="idle"?!1:(e||this.state.resource.silencePaddingFrames===0?this.state={status:"idle"}:this.state.resource.silenceRemaining===-1&&(this.state.resource.silenceRemaining=this.state.resource.silencePaddingFrames),!0)}checkPlayable(){let e=this._state;return e.status==="idle"||e.status==="buffering"?!1:e.resource.readable?!0:(this.state={status:"idle"},!1)}_stepDispatch(){let e=this._state;e.status==="idle"||e.status==="buffering"||this.playable.forEach(t=>t.dispatchAudio())}_stepPrepare(){let e=this._state;if(e.status==="idle"||e.status==="buffering")return;let t=this.playable;if(e.status==="autopaused"&&t.length>0&&(this.state={...e,status:"playing",missedFrames:0}),e.status==="paused"||e.status==="autopaused"){e.silencePacketsRemaining>0&&(e.silencePacketsRemaining--,this._preparePacket(P,t,e),e.silencePacketsRemaining===0&&this._signalStopSpeaking());return}if(t.length===0)if(this.behaviors.noSubscriber==="pause"){this.state={...e,status:"autopaused",silencePacketsRemaining:5};return}else this.behaviors.noSubscriber==="stop"&&this.stop(!0);let o=e.resource.read();e.status==="playing"&&(o?(this._preparePacket(o,t,e),e.missedFrames=0):(this._preparePacket(P,t,e),e.missedFrames++,e.missedFrames>=this.behaviors.maxMissedFrames&&this.stop()))}_signalStopSpeaking(){return this.subscribers.forEach(({connection:e})=>e.setSpeaking(!1))}_preparePacket(e,t,o){o.playbackDuration+=20,t.forEach(s=>s.prepareAudioPacket(e))}};function we(i){return new B(i)}var Ve=(o=>(o[o.Manual=0]="Manual",o[o.AfterSilence=1]="AfterSilence",o[o.AfterInactivity=2]="AfterInactivity",o))(Ve||{});function Z(){return{end:{behavior:0}}}var U=class extends xe.Readable{constructor({end:e,...t}){super({...t,objectMode:!0});r(this,"end");r(this,"endTimeout");this.end=e}push(e){return e&&(this.end.behavior===2||this.end.behavior===1&&(e.compare(P)!==0||typeof this.endTimeout=="undefined"))&&this.renewEndTimeout(this.end),super.push(e)}renewEndTimeout(e){this.endTimeout&&clearTimeout(this.endTimeout),this.endTimeout=setTimeout(()=>this.push(null),e.duration)}_read(){}};var De=require("tiny-typed-emitter"),Q=class extends De.TypedEmitter{constructor(){super();r(this,"users");r(this,"speakingTimeouts");this.users=new Map,this.speakingTimeouts=new Map}onPacket(e){let t=this.speakingTimeouts.get(e);t?clearTimeout(t):(this.users.set(e,Date.now()),this.emit("start",e)),this.startTimeout(e)}startTimeout(e){this.speakingTimeouts.set(e,setTimeout(()=>{this.emit("end",e),this.speakingTimeouts.delete(e),this.users.delete(e)},Q.DELAY))}},I=Q;r(I,"DELAY",100);var Ee=require("tiny-typed-emitter"),W=class extends Ee.TypedEmitter{constructor(){super();r(this,"map");this.map=new Map}update(e){let t=this.map.get(e.audioSSRC),o={...this.map.get(e.audioSSRC),...e};this.map.set(e.audioSSRC,o),t||this.emit("create",o),this.emit("update",t,o)}get(e){if(typeof e=="number")return this.map.get(e);for(let t of this.map.values())if(t.userId===e)return t}delete(e){if(typeof e=="number"){let t=this.map.get(e);return t&&(this.map.delete(e),this.emit("delete",t)),t}for(let[t,o]of this.map.entries())if(o.userId===e)return this.map.delete(t),this.emit("delete",o),o}};var j=class{constructor(e){r(this,"voiceConnection");r(this,"ssrcMap");r(this,"subscriptions");r(this,"connectionData");r(this,"speaking");this.voiceConnection=e,this.ssrcMap=new W,this.speaking=new I,this.subscriptions=new Map,this.connectionData={},this.onWsPacket=this.onWsPacket.bind(this),this.onUdpMessage=this.onUdpMessage.bind(this)}onWsPacket(e){e.op===F.VoiceOpcodes.ClientDisconnect&&typeof e.d?.user_id=="string"?this.ssrcMap.delete(e.d.user_id):e.op===F.VoiceOpcodes.Speaking&&typeof e.d?.user_id=="string"&&typeof e.d?.ssrc=="number"?this.ssrcMap.update({userId:e.d.user_id,audioSSRC:e.d.ssrc}):e.op===F.VoiceOpcodes.ClientConnect&&typeof e.d?.user_id=="string"&&typeof e.d?.audio_ssrc=="number"&&this.ssrcMap.update({userId:e.d.user_id,audioSSRC:e.d.audio_ssrc,videoSSRC:e.d.video_ssrc===0?void 0:e.d.video_ssrc})}decrypt(e,t,o,s){let n;t==="xsalsa20_poly1305_lite"?(e.copy(o,0,e.length-4),n=e.length-4):t==="xsalsa20_poly1305_suffix"?(e.copy(o,0,e.length-24),n=e.length-24):e.copy(o,0,0,12);let a=g.open(e.slice(12,n),o,s);if(!!a)return Buffer.from(a)}parsePacket(e,t,o,s){let n=this.decrypt(e,t,o,s);if(!!n){if(n[0]===190&&n[1]===222&&n.length>4){let a=n.readUInt16BE(2),d=4;for(let S=0;S<a;S++){let C=n[d];d++,C!==0&&(d+=1+(C>>4))}let m=n.readUInt8(d);(m===0||m===2)&&d++,n=n.slice(d)}return n}}onUdpMessage(e){if(e.length<=8)return;let t=e.readUInt32BE(8),o=this.ssrcMap.get(t);if(!o)return;this.speaking.onPacket(o.userId);let s=this.subscriptions.get(o.userId);if(!!s&&this.connectionData.encryptionMode&&this.connectionData.nonceBuffer&&this.connectionData.secretKey){let n=this.parsePacket(e,this.connectionData.encryptionMode,this.connectionData.nonceBuffer,this.connectionData.secretKey);n?s.push(n):s.destroy(new Error("Failed to parse packet"))}}subscribe(e,t){let o=this.subscriptions.get(e);if(o)return o;let s=new U({...Z(),...t});return s.once("close",()=>this.subscriptions.delete(e)),this.subscriptions.set(e,s),s}};var M=(n=>(n.Signalling="signalling",n.Connecting="connecting",n.Ready="ready",n.Disconnected="disconnected",n.Destroyed="destroyed",n))(M||{}),ee=(s=>(s[s.WebSocketClose=0]="WebSocketClose",s[s.AdapterUnavailable=1]="AdapterUnavailable",s[s.EndpointRemoved=2]="EndpointRemoved",s[s.Manual=3]="Manual",s))(ee||{}),G=class extends Re.TypedEmitter{constructor(e,{debug:t,adapterCreator:o}){super();r(this,"rejoinAttempts");r(this,"_state");r(this,"joinConfig");r(this,"packets");r(this,"receiver");r(this,"debug");this.debug=t?n=>this.emit("debug",n):null,this.rejoinAttempts=0,this.receiver=new j(this),this.onNetworkingClose=this.onNetworkingClose.bind(this),this.onNetworkingStateChange=this.onNetworkingStateChange.bind(this),this.onNetworkingError=this.onNetworkingError.bind(this),this.onNetworkingDebug=this.onNetworkingDebug.bind(this);let s=o({onVoiceServerUpdate:n=>this.addServerPacket(n),onVoiceStateUpdate:n=>this.addStatePacket(n),destroy:()=>this.destroy(!1)});this._state={status:"signalling",adapter:s},this.packets={server:void 0,state:void 0},this.joinConfig=e}get state(){return this._state}set state(e){let t=this._state,o=Reflect.get(t,"networking"),s=Reflect.get(e,"networking"),n=Reflect.get(t,"subscription"),a=Reflect.get(e,"subscription");if(o!==s&&(o&&(o.on("error",p),o.off("debug",this.onNetworkingDebug),o.off("error",this.onNetworkingError),o.off("close",this.onNetworkingClose),o.off("stateChange",this.onNetworkingStateChange),o.destroy()),s&&this.updateReceiveBindings(s.state,o?.state)),e.status==="ready")this.rejoinAttempts=0;else if(e.status==="destroyed")for(let d of this.receiver.subscriptions.values())d.destroyed||d.destroy();t.status!=="destroyed"&&e.status==="destroyed"&&t.adapter.destroy(),this._state=e,n&&n!==a&&n.unsubscribe(),this.emit("stateChange",t,e),t.status!==e.status&&this.emit(e.status,t,e)}addServerPacket(e){this.packets.server=e,e.endpoint?this.configureNetworking():this.state.status!=="destroyed"&&(this.state={...this.state,status:"disconnected",reason:2})}addStatePacket(e){this.packets.state=e,typeof e.self_deaf!="undefined"&&(this.joinConfig.selfDeaf=e.self_deaf),typeof e.self_mute!="undefined"&&(this.joinConfig.selfMute=e.self_mute),e.channel_id&&(this.joinConfig.channelId=e.channel_id)}updateReceiveBindings(e,t){let o=Reflect.get(t??{},"ws"),s=Reflect.get(e,"ws"),n=Reflect.get(t??{},"udp"),a=Reflect.get(e,"udp");o!==s&&(o?.off("packet",this.receiver.onWsPacket),s?.on("packet",this.receiver.onWsPacket)),n!==a&&(n?.off("message",this.receiver.onUdpMessage),a?.on("message",this.receiver.onUdpMessage)),this.receiver.connectionData=Reflect.get(e,"connectionData")??{}}configureNetworking(){let{server:e,state:t}=this.packets;if(!e||!t||this.state.status==="destroyed"||!e.endpoint)return;let o=new z({endpoint:e.endpoint,serverId:e.guild_id,token:e.token,sessionId:t.session_id,userId:t.user_id},Boolean(this.debug));o.once("close",this.onNetworkingClose),o.on("stateChange",this.onNetworkingStateChange),o.on("error",this.onNetworkingError),o.on("debug",this.onNetworkingDebug),this.state={...this.state,status:"connecting",networking:o}}onNetworkingClose(e){this.state.status!=="destroyed"&&(e===4014?this.state={...this.state,status:"disconnected",reason:0,closeCode:e}:(this.state={...this.state,status:"signalling"},this.rejoinAttempts++,this.state.adapter.sendPayload(k(this.joinConfig))||(this.state={...this.state,status:"disconnected",reason:1})))}onNetworkingStateChange(e,t){this.updateReceiveBindings(t,e),e.code!==t.code&&(this.state.status!=="connecting"&&this.state.status!=="ready"||(t.code===4?this.state={...this.state,status:"ready"}:t.code!==6&&(this.state={...this.state,status:"connecting"})))}onNetworkingError(e){this.emit("error",e)}onNetworkingDebug(e){this.debug?.([NW] ${e})}prepareAudioPacket(e){let t=this.state;if(t.status==="ready")return t.networking.prepareAudioPacket(e)}dispatchAudio(){let e=this.state;if(e.status==="ready")return e.networking.dispatchAudio()}playOpusPacket(e){let t=this.state;if(t.status==="ready")return t.networking.prepareAudioPacket(e),t.networking.dispatchAudio()}destroy(e=!0){if(this.state.status==="destroyed")throw new Error("Cannot destroy VoiceConnection - it has already been destroyed");E(this.joinConfig.guildId)===this&&ae(this),e&&this.state.adapter.sendPayload(k({...this.joinConfig,channelId:null})),this.state={status:"destroyed"}}disconnect(){return this.state.status==="destroyed"||this.state.status==="signalling"?!1:(this.joinConfig.channelId=null,this.state.adapter.sendPayload(k(this.joinConfig))?(this.state={adapter:this.state.adapter,reason:3,status:"disconnected"},!0):(this.state={adapter:this.state.adapter,subscription:this.state.subscription,status:"disconnected",reason:1},!1))}rejoin(e){if(this.state.status==="destroyed")return!1;let t=this.state.status!=="ready";return t&&this.rejoinAttempts++,Object.assign(this.joinConfig,e),this.state.adapter.sendPayload(k(this.joinConfig))?(t&&(this.state={...this.state,status:"signalling"}),!0):(this.state={adapter:this.state.adapter,subscription:this.state.subscription,status:"disconnected",reason:1},!1)}setSpeaking(e){return this.state.status!=="ready"?!1:this.state.networking.setSpeaking(e)}subscribe(e){if(this.state.status==="destroyed")return;let t=e.subscribe(this);return this.state={...this.state,subscription:t},t}get ping(){return this.state.status==="ready"&&this.state.networking.state.code===4?{ws:this.state.networking.state.ws.ping,udp:this.state.networking.state.udp.ping}:{ws:void 0,udp:void 0}}onSubscriptionRemoved(e){this.state.status!=="destroyed"&&this.state.subscription===e&&(this.state={...this.state,subscription:void 0})}};function Oe(i,e){let t=k(i),o=E(i.guildId);if(o&&o.state.status!=="destroyed")return o.state.status==="disconnected"?o.rejoin({channelId:i.channelId,selfDeaf:i.selfDeaf,selfMute:i.selfMute}):o.state.adapter.sendPayload(t)||(o.state={...o.state,status:"disconnected",reason:1}),o;let s=new G(i,e);return ce(s),s.state.status!=="destroyed"&&(s.state.adapter.sendPayload(t)||(s.state={...s.state,status:"disconnected",reason:1})),s}function gt(i){let e={selfDeaf:!0,selfMute:!1,group:"default",...i};return Oe(e,{adapterCreator:i.adapterCreator,debug:i.debug})}var h=V(require("prism-media")),Ie=["-analyzeduration","0","-loglevel","0","-f","s16le","-ar","48000","-ac","2"],Te=["-analyzeduration","0","-loglevel","0","-acodec","libopus","-f","opus","-ar","48000","-ac","2"],v=(n=>(n.Arbitrary="arbitrary",n.Raw="raw",n.OggOpus="ogg/opus",n.WebmOpus="webm/opus",n.Opus="opus",n))(v||{});var _e=class{constructor(e){r(this,"edges",[]);r(this,"type");this.type=e}addEdge(e){this.edges.push({...e,from:this})}},Ne=new Map;for(let i of Object.values(v))Ne.set(i,new _e(i));function u(i){let e=Ne.get(i);if(!e)throw new Error(Node type '${i}' does not exist!);return e}u("raw").addEdge({type:"opus encoder",to:u("opus"),cost:1.5,transformer:()=>new h.default.opus.Encoder({rate:48e3,channels:2,frameSize:960})});u("opus").addEdge({type:"opus decoder",to:u("raw"),cost:1.5,transformer:()=>new h.default.opus.Decoder({rate:48e3,channels:2,frameSize:960})});u("ogg/opus").addEdge({type:"ogg/opus demuxer",to:u("opus"),cost:1,transformer:()=>new h.default.opus.OggDemuxer});u("webm/opus").addEdge({type:"webm/opus demuxer",to:u("opus"),cost:1,transformer:()=>new h.default.opus.WebmDemuxer});var te={type:"ffmpeg pcm",to:u("raw"),cost:2,transformer:i=>new h.default.FFmpeg({args:typeof i=="string"?["-i",i,...Ie]:Ie})};u("arbitrary").addEdge(te);u("ogg/opus").addEdge(te);u("webm/opus").addEdge(te);u("raw").addEdge({type:"volume transformer",to:u("raw"),cost:.5,transformer:()=>new h.default.VolumeTransformer({type:"s16le"})});function yt(){try{return h.default.FFmpeg.getInfo().output.includes("--enable-libopus")}catch{}return!1}if(yt()){let i={type:"ffmpeg ogg",to:u("ogg/opus"),cost:2,transformer:e=>new h.default.FFmpeg({args:typeof e=="string"?["-i",e,...Te]:Te})};u("arbitrary").addEdge(i),u("ogg/opus").addEdge(i),u("webm/opus").addEdge(i)}function Be(i,e,t=u("opus"),o=[],s=5){if(i===t&&e(o))return{cost:0};if(s===0)return{cost:1/0};let n;for(let a of i.edges){if(n&&a.cost>n.cost)continue;let d=Be(a.to,e,t,[...o,a],s-1),m=a.cost+d.cost;(!n||m<n.cost)&&(n={cost:m,edge:a,next:d})}return n??{cost:1/0}}function bt(i){let e=[],t=i;for(;t?.edge;)e.push(t.edge),t=t.next;return e}function Me(i,e){return bt(Be(u(i),e))}var Ue=require("stream");var y=V(require("prism-media"));var T=class{constructor(e,t,o,s){r(this,"playStream");r(this,"edges");r(this,"metadata");r(this,"volume");r(this,"encoder");r(this,"audioPlayer");r(this,"playbackDuration",0);r(this,"started",!1);r(this,"silencePaddingFrames");r(this,"silenceRemaining",-1);this.edges=e,this.playStream=t.length>1?(0,Ue.pipeline)(t,p):t[0],this.metadata=o,this.silencePaddingFrames=s;for(let n of t)n instanceof y.default.VolumeTransformer?this.volume=n:n instanceof y.default.opus.Encoder&&(this.encoder=n);this.playStream.once("readable",()=>this.started=!0)}get readable(){if(this.silenceRemaining===0)return!1;let e=this.playStream.readable;return e||(this.silenceRemaining===-1&&(this.silenceRemaining=this.silencePaddingFrames),this.silenceRemaining!==0)}get ended(){return this.playStream.readableEnded||this.playStream.destroyed||this.silenceRemaining===0}read(){if(this.silenceRemaining===0)return null;if(this.silenceRemaining>0)return this.silenceRemaining--,P;let e=this.playStream.read();return e&&(this.playbackDuration+=20),e}},St=i=>i.some(e=>e.type==="volume transformer"),Ct=()=>!0;function kt(i){return i instanceof y.default.opus.Encoder?{streamType:"opus",hasVolume:!1}:i instanceof y.default.opus.Decoder?{streamType:"raw",hasVolume:!1}:i instanceof y.default.VolumeTransformer?{streamType:"raw",hasVolume:!0}:i instanceof y.default.opus.OggDemuxer?{streamType:"opus",hasVolume:!1}:i instanceof y.default.opus.WebmDemuxer?{streamType:"opus",hasVolume:!1}:{streamType:"arbitrary",hasVolume:!1}}function We(i,e={}){let t=e.inputType,o=Boolean(e.inlineVolume);if(typeof i=="string")t="arbitrary";else if(typeof t=="undefined"){let a=kt(i);t=a.streamType,o=o&&!a.hasVolume}let s=Me(t,o?St:Ct);if(s.length===0){if(typeof i=="string")throw new Error(Invalid pipeline constructed for string resource '${i}');return new T([],[i],e.metadata??null,e.silencePaddingFrames??5)}let n=s.map(a=>a.transformer(i));return typeof i!="string"&&n.unshift(i),new T(s,n,e.metadata??null,e.silencePaddingFrames??5)}var _=require("path"),je=V(require("prism-media"));function Ge(i,e,t){if(t===0)return;let o=(0,_.resolve)(i,"./package.json");try{let s=require(o);if(s.name!==e)throw new Error("package.json does not match");return s}catch{return Ge((0,_.resolve)(i,".."),e,t-1)}}function Pt(i){try{return(i==="@discordjs/voice"?Fe():Ge((0,_.dirname)(require.resolve(i)),i,3))?.version??"not found"}catch{return"not found"}}function vt(){let i=[],e=t=>i.push(- ${t}: ${Pt(t)});i.push("Core Dependencies"),e("@discordjs/voice"),e("prism-media"),i.push(""),i.push("Opus Libraries"),e("@discordjs/opus"),e("opusscript"),i.push(""),i.push("Encryption Libraries"),e("sodium"),e("libsodium-wrappers"),e("tweetnacl"),i.push(""),i.push("FFmpeg");try{let t=je.default.FFmpeg.getInfo();i.push(- version: ${t.version}),i.push(- libopus: ${t.output.includes("--enable-libopus")?"yes":"no"})}catch{i.push("- not found")}return["-".repeat(50),...i,"-".repeat(50)].join(

Error: Cannot destroy VoiceConnection - it has already been destroyed at G.destroy (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord-player\node_modules\@discordjs\voice\dist\index.js:8:10564) at VoiceUtils. (D:\Projekti\DBM\Pink Panter Moderator\node_modules\discord-player\dist\VoiceInterface\VoiceUtils.js:59:22) at Generator.throw () at rejected (D:\Projekti\DBM\Pink Panter Moderator\node_modules\tslib\tslib.js:165:69)

Node.js v18.13.0

Gotowka commented 1 year ago

I don't know how fix this errors, I used in js bot the latest version and it's working. If DBM got the discord.js version 14.+ can it work