Improve voice connection checking, take advantage of optional chaining operators
This commit is contained in:
parent
df43f9eb9d
commit
398ce07bd2
11 changed files with 36 additions and 27 deletions
|
@ -5,7 +5,7 @@ import { random } from "../utils/misc.js";
|
|||
export default async (client, cluster, worker, ipc, member, oldChannel) => {
|
||||
if (!oldChannel) return;
|
||||
const connection = players.get(oldChannel.guild.id);
|
||||
if (connection && oldChannel.id === connection.voiceChannel.id) {
|
||||
if (oldChannel.id === connection?.voiceChannel.id) {
|
||||
if (oldChannel.voiceMembers.filter((i) => i.id !== client.user.id && !i.bot).length === 0) {
|
||||
connection.player.setPaused(true);
|
||||
const waitMessage = await client.createMessage(connection.originalChannel.id, "🔊 Waiting 10 seconds for someone to return...");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue