Catch more message deletes
This commit is contained in:
parent
d14515f453
commit
59e63065f1
1 changed files with 15 additions and 3 deletions
|
@ -16,7 +16,11 @@ export default async (client, cluster, worker, ipc, member, oldChannel) => {
|
||||||
players.set(connection.voiceChannel.guild.id, { player: connection.player, type: connection.type, host: member.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel, loop: connection.loop, shuffle: connection.shuffle, playMessage: connection.playMessage });
|
players.set(connection.voiceChannel.guild.id, { player: connection.player, type: connection.type, host: member.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel, loop: connection.loop, shuffle: connection.shuffle, playMessage: connection.playMessage });
|
||||||
waitMessage.edit(`🔊 ${member.mention} is the new voice channel host.`);
|
waitMessage.edit(`🔊 ${member.mention} is the new voice channel host.`);
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete();
|
if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete();
|
||||||
|
} catch {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
connection.player.stop(connection.originalChannel.guild.id);
|
connection.player.stop(connection.originalChannel.guild.id);
|
||||||
manager.leave(connection.originalChannel.guild.id);
|
manager.leave(connection.originalChannel.guild.id);
|
||||||
connection.player.destroy();
|
connection.player.destroy();
|
||||||
|
@ -31,11 +35,19 @@ export default async (client, cluster, worker, ipc, member, oldChannel) => {
|
||||||
const awaitRejoin = new AwaitRejoin(oldChannel, false, member.id);
|
const awaitRejoin = new AwaitRejoin(oldChannel, false, member.id);
|
||||||
awaitRejoin.on("end", (rejoined) => {
|
awaitRejoin.on("end", (rejoined) => {
|
||||||
if (rejoined) {
|
if (rejoined) {
|
||||||
|
try {
|
||||||
if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete();
|
if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete();
|
||||||
|
} catch {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const members = oldChannel.voiceMembers.filter((i) => i.id !== client.user.id);
|
const members = oldChannel.voiceMembers.filter((i) => i.id !== client.user.id);
|
||||||
if (members.length === 0) {
|
if (members.length === 0) {
|
||||||
|
try {
|
||||||
if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete();
|
if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete();
|
||||||
|
} catch {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
connection.player.stop(connection.originalChannel.guild.id);
|
connection.player.stop(connection.originalChannel.guild.id);
|
||||||
manager.leave(connection.originalChannel.guild.id);
|
manager.leave(connection.originalChannel.guild.id);
|
||||||
connection.player.destroy();
|
connection.player.destroy();
|
||||||
|
|
Loading…
Reference in a new issue