mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-07 13:33:13 +02:00
feat: discord.js v13
This commit is contained in:
parent
a4e67d6383
commit
8448feebb6
13 changed files with 381 additions and 154 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue