diff options
| author | Hellyson Rodrigo Parteka <[email protected]> | 2021-11-12 16:30:18 -0300 |
|---|---|---|
| committer | Hellyson Rodrigo Parteka <[email protected]> | 2021-11-12 16:30:18 -0300 |
| commit | 8448feebb6e8154ed0338989a0646be7918eb595 (patch) | |
| tree | aa19f5f08c3208be70898f044f15ae694cf34b8b /src/events | |
| parent | a4e67d63839154916783e7b4a5f6c65006e759f3 (diff) | |
| download | muse-8448feebb6e8154ed0338989a0646be7918eb595.tar.xz muse-8448feebb6e8154ed0338989a0646be7918eb595.zip | |
feat: discord.js v13
Diffstat (limited to 'src/events')
| -rw-r--r-- | src/events/guild-create.ts | 6 | ||||
| -rw-r--r-- | src/events/voice-state-update.ts | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/events/guild-create.ts b/src/events/guild-create.ts index 3bcf281..01f0910 100644 --- a/src/events/guild-create.ts +++ b/src/events/guild-create.ts @@ -9,7 +9,7 @@ const DEFAULT_PREFIX = '!'; export default async (guild: Guild): Promise<void> => { await Settings.upsert({guildId: guild.id, prefix: DEFAULT_PREFIX}); - const owner = await guild.client.users.fetch(guild.ownerID); + const owner = await guild.client.users.fetch(guild.ownerId); let firstStep = '👋 Hi!\n'; firstStep += 'I just need to ask a few questions before you start listening to music.\n\n'; @@ -27,7 +27,7 @@ export default async (guild: Guild): Promise<void> => { const emojiChannels: EmojiChannel[] = []; for (const [channelId, channel] of guild.channels.cache) { - if (channel.type === 'text') { + if (channel.type === 'GUILD_TEXT') { emojiChannels.push({ name: channel.name, id: channelId, @@ -65,7 +65,7 @@ export default async (guild: Guild): Promise<void> => { await owner.send(secondStep); - const prefixResponses = await firstStepMsg.channel.awaitMessages((r: Message) => r.content.length === 1, {max: 1}); + const prefixResponses = await firstStepMsg.channel.awaitMessages({filter: (r: Message) => r.content.length === 1, max: 1}); const prefixCharacter = prefixResponses.first()!.content; diff --git a/src/events/voice-state-update.ts b/src/events/voice-state-update.ts index 6440949..69b4504 100644 --- a/src/events/voice-state-update.ts +++ b/src/events/voice-state-update.ts @@ -1,4 +1,4 @@ -import {VoiceState} from 'discord.js'; +import {VoiceChannel, VoiceState} from 'discord.js'; import container from '../inversify.config.js'; import {TYPES} from '../types.js'; import PlayerManager from '../managers/player.js'; @@ -10,7 +10,8 @@ export default (oldState: VoiceState, _: VoiceState): void => { const player = playerManager.get(oldState.guild.id); if (player.voiceConnection) { - if (getSizeWithoutBots(player.voiceConnection.channel) === 0) { + const voiceChannel: VoiceChannel = oldState.guild.channels.cache.get(player.voiceConnection.joinConfig.channelId!) as VoiceChannel; + if (!voiceChannel || getSizeWithoutBots(voiceChannel) === 0) { player.disconnect(); } } |
