mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-11 20:31:35 +02:00
fix command permission handling and push discord to v10 (#640)
Co-authored-by: Max Isom <hi@maxisom.me>
This commit is contained in:
parent
1ef05aba9d
commit
eb2885b206
38 changed files with 1214 additions and 644 deletions
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable complexity */
|
||||
import {CommandInteraction, GuildMember} from 'discord.js';
|
||||
import {ChatInputCommandInteraction, GuildMember} from 'discord.js';
|
||||
import {inject, injectable} from 'inversify';
|
||||
import shuffle from 'array-shuffle';
|
||||
import {TYPES} from '../types.js';
|
||||
|
@ -12,7 +12,8 @@ import {getMemberVoiceChannel, getMostPopularVoiceChannel} from '../utils/channe
|
|||
|
||||
@injectable()
|
||||
export default class AddQueryToQueue {
|
||||
constructor(@inject(TYPES.Services.GetSongs) private readonly getSongs: GetSongs, @inject(TYPES.Managers.Player) private readonly playerManager: PlayerManager) {}
|
||||
constructor(@inject(TYPES.Services.GetSongs) private readonly getSongs: GetSongs, @inject(TYPES.Managers.Player) private readonly playerManager: PlayerManager) {
|
||||
}
|
||||
|
||||
public async addToQueue({
|
||||
query,
|
||||
|
@ -25,7 +26,7 @@ export default class AddQueryToQueue {
|
|||
addToFrontOfQueue: boolean;
|
||||
shuffleAdditions: boolean;
|
||||
shouldSplitChapters: boolean;
|
||||
interaction: CommandInteraction;
|
||||
interaction: ChatInputCommandInteraction;
|
||||
}): Promise<void> {
|
||||
const guildId = interaction.guild!.id;
|
||||
const player = this.playerManager.get(guildId);
|
||||
|
@ -121,7 +122,11 @@ export default class AddQueryToQueue {
|
|||
}
|
||||
|
||||
newSongs.forEach(song => {
|
||||
player.add({...song, addedInChannelId: interaction.channel!.id, requestedBy: interaction.member!.user.id}, {immediate: addToFrontOfQueue ?? false});
|
||||
player.add({
|
||||
...song,
|
||||
addedInChannelId: interaction.channel!.id,
|
||||
requestedBy: interaction.member!.user.id,
|
||||
}, {immediate: addToFrontOfQueue ?? false});
|
||||
});
|
||||
|
||||
const firstSong = newSongs[0];
|
||||
|
|
|
@ -18,7 +18,7 @@ const CONFIG_MAP = {
|
|||
CACHE_DIR: path.join(DATA_DIR, 'cache'),
|
||||
CACHE_LIMIT_IN_BYTES: xbytes.parseSize(process.env.CACHE_LIMIT ?? '2GB'),
|
||||
BOT_STATUS: process.env.BOT_STATUS ?? 'online',
|
||||
BOT_ACTIVITY_TYPE: process.env.BOT_ACTIVITY_TYPE ?? 'LISTENING',
|
||||
BOT_ACTIVITY_TYPE: process.env.BOT_ACTIVITY_TYPE ?? 'Listening',
|
||||
BOT_ACTIVITY_URL: process.env.BOT_ACTIVITY_URL ?? '',
|
||||
BOT_ACTIVITY: process.env.BOT_ACTIVITY ?? 'music',
|
||||
} as const;
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
AudioPlayerState,
|
||||
AudioPlayerStatus,
|
||||
createAudioPlayer,
|
||||
createAudioResource,
|
||||
createAudioResource, DiscordGatewayAdapterCreator,
|
||||
joinVoiceChannel,
|
||||
StreamType,
|
||||
VoiceConnection,
|
||||
|
@ -82,7 +82,7 @@ export default class {
|
|||
this.voiceConnection = joinVoiceChannel({
|
||||
channelId: channel.id,
|
||||
guildId: channel.guild.id,
|
||||
adapterCreator: channel.guild.voiceAdapterCreator,
|
||||
adapterCreator: channel.guild.voiceAdapterCreator as DiscordGatewayAdapterCreator,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class {
|
|||
items.push(...tracksResponse.items.map(playlistItem => playlistItem.track));
|
||||
}
|
||||
|
||||
const tracks = this.limitTracks(items, playlistLimit).map(this.toSpotifyTrack);
|
||||
const tracks = this.limitTracks(items.filter(i => i !== null) as SpotifyApi.TrackObjectSimplified[], playlistLimit).map(this.toSpotifyTrack);
|
||||
|
||||
return [tracks, playlist];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue