Renommage types any et fix /crack
This commit is contained in:
@@ -3,8 +3,8 @@ import { SlashCommandBuilder, ChatInputCommandInteraction, EmbedBuilder, APIEmbe
|
||||
import dbGuildInit from '../../utils/dbGuildInit'
|
||||
import dbGuild from '../../schemas/guild'
|
||||
|
||||
const parseObject = (obj: any, prefix = ''): { name: string, value: any }[] => {
|
||||
let fields: { name: string, value: any }[] = []
|
||||
const parseObject = (obj: object, prefix = ''): { name: string, value: object | string | boolean }[] => {
|
||||
let fields: { name: string, value: object | string | boolean }[] = []
|
||||
|
||||
for (let [key, value] of Object.entries(obj)) {
|
||||
if (typeof value === 'object') fields.push(...parseObject(value, `${prefix}${key}.`))
|
||||
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
else return
|
||||
}
|
||||
try { if (!queue.connection) await queue.connect(voiceChannel) }
|
||||
catch (error: any) { console.error(error) }
|
||||
catch (error: unknown) { console.error(error) }
|
||||
|
||||
|
||||
let guildProfile = await dbGuild.findOne({ guildId: queue.guild.id })
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
if (!queue.isPlaying()) await queue.node.play()
|
||||
let track_source = track.source === 'youtube' ? 'Youtube' : track.source === 'spotify' ? 'Spotify' : 'Inconnu'
|
||||
return interaction.followUp(`Chargement de la musique **${track.title}** de **${track.author}** sur **${track_source}**...`)
|
||||
} catch (error: any) { console.error(error) }
|
||||
} catch (error: unknown) { console.error(error) }
|
||||
finally { queue.tasksQueue.release() }
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,14 @@ export default {
|
||||
for (let i = 0; i < games.length; i++) await message.react(emojis[i])
|
||||
|
||||
// Wait for a reaction to be added by the interaction author.
|
||||
const filter: any = (reaction: MessageReaction, user: User) => { if (reaction.emoji.name) return emojis.includes(reaction.emoji.name) && user.id === interaction.user.id }
|
||||
const filter = (reaction: MessageReaction, user: User) => { if (reaction.emoji.name) { return emojis.includes(reaction.emoji.name) && user.id === interaction.user.id } return false }
|
||||
await message.awaitReactions({ filter, max: 1, time: 5000, errors: ['time'] }).then(collected => {
|
||||
console.log(collected)
|
||||
if (!collected.first) return
|
||||
let reaction = collected.first()
|
||||
let index = emojis.indexOf(reaction?.emoji.name ?? '')
|
||||
game = games[index]
|
||||
}).catch(() => { return interaction.followUp({ content: 'T\'as mis trop de temps à choisir !' }) })
|
||||
}).catch(() => { return interaction.followUp({ content: "T'as mis trop de temps à choisir !" }) })
|
||||
}
|
||||
else game = games[0]
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export default {
|
||||
connection.subscribe(player)
|
||||
|
||||
let stream = connection.receiver.subscribe(user.id, { end: { behavior: EndBehaviorType.Manual } })
|
||||
stream.on('data', (chunk) => {
|
||||
stream.on('data', () => {
|
||||
if (!user) return
|
||||
if (connection.receiver.speaking.users.has(user.id) && !playing) {
|
||||
playing = true
|
||||
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
let guild = interaction.guild as Guild
|
||||
|
||||
guild.members.fetch().then(() => {
|
||||
var i = 0
|
||||
let i = 0
|
||||
guild.members.cache.forEach(async member => { if (!member.user.bot) i++ })
|
||||
let channel = guild.channels.cache.get('1091140609139560508')
|
||||
if (!channel) return
|
||||
|
||||
Reference in New Issue
Block a user