mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 16:54:16 +02:00
fix(arabot): deleted channel errors
This commit is contained in:
parent
502d5c5cdf
commit
cf8142b86a
@ -17,8 +17,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type { VoiceChannel } from 'discord.js';
|
||||
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
|
||||
import { ChannelType } from 'discord.js';
|
||||
|
||||
export class VerifyTimeout extends ScheduledTask {
|
||||
public constructor(
|
||||
@ -32,15 +32,22 @@ export class VerifyTimeout extends ScheduledTask {
|
||||
// Get the guild where the user is in
|
||||
let channel = this.container.client.channels.cache.get(
|
||||
payload.channelId,
|
||||
) as VoiceChannel | undefined;
|
||||
);
|
||||
if (channel === undefined) {
|
||||
channel = (await this.container.client.channels.fetch(
|
||||
const channelFetch = await this.container.client.channels.fetch(
|
||||
payload.channelId,
|
||||
)) as VoiceChannel | undefined;
|
||||
if (channel === undefined) {
|
||||
).catch(() => null);
|
||||
if (channelFetch === null) {
|
||||
this.container.logger.error('verifyTimeout: Channel not found!');
|
||||
return;
|
||||
}
|
||||
|
||||
channel = channelFetch;
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildVoice) {
|
||||
this.container.logger.error('verifyTimeout: Channel is not a voice channel!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel.members.size < 2 && channel.members.has(payload.userId)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user