Voice state handling

This commit is contained in:
Snowflake107 2021-06-26 00:53:34 +05:45
parent 574c163f5b
commit 2423ba72e1

View file

@ -69,29 +69,27 @@ class Player extends EventEmitter<PlayerEvents> {
const queue = this.getQueue(oldState.guild.id);
if (!queue) return;
// @todo
// update channel
// if (oldState.channelID && newState.channelID && oldState.channelID !== newState.channelID) {
// queue.connection.channel = newState.channel;
// }
if (oldState.channelID && newState.channelID && oldState.channelID !== newState.channelID) {
queue.connection.channel = newState.channel;
}
// if (!oldState.channelID && newState.channelID && newState.member.id === newState.guild.me.id) {
// if (newState.serverMute || !newState.serverMute) {
// queue.setPaused(newState.serverMute);
// } else if (newState.suppress || !newState.suppress) {
// if (newState.suppress) newState.guild.me.voice.setRequestToSpeak(true).catch(Util.noop);
// queue.setPaused(newState.suppress);
// }
// }
if (!oldState.channelID && newState.channelID && newState.member.id === newState.guild.me.id) {
if (newState.serverMute || !newState.serverMute) {
queue.setPaused(newState.serverMute);
} else if (newState.suppress || !newState.suppress) {
if (newState.suppress) newState.guild.me.voice.setRequestToSpeak(true).catch(Util.noop);
queue.setPaused(newState.suppress);
}
}
// if (oldState.channelID === newState.channelID && oldState.member.id === newState.guild.me.id) {
// if (oldState.serverMute !== newState.serverMute) {
// queue.setPaused(newState.serverMute);
// } else if (oldState.suppress !== newState.suppress) {
// if (newState.suppress) newState.guild.me.voice.setRequestToSpeak(true).catch(Util.noop);
// queue.setPaused(newState.suppress);
// }
// }
if (oldState.channelID === newState.channelID && oldState.member.id === newState.guild.me.id) {
if (oldState.serverMute !== newState.serverMute) {
queue.setPaused(newState.serverMute);
} else if (oldState.suppress !== newState.suppress) {
if (newState.suppress) newState.guild.me.voice.setRequestToSpeak(true).catch(Util.noop);
queue.setPaused(newState.suppress);
}
}
if (oldState.member.id === this.client.user.id && !newState.channelID) {
queue.destroy();