Réécriture complète 4.0
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
import { SlashCommandBuilder, ChatInputCommandInteraction, GuildMember } from 'discord.js'
|
||||
import { getVoiceConnection, joinVoiceChannel } from '@discordjs/voice'
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('papa')
|
||||
.setDescription('Si papa m\'appelle, je le rejoins !'),
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
if (interaction.user.id !== '223831938346123275') return interaction.reply({ content: 'T\'es pas mon père, dégage !' })
|
||||
|
||||
let guild = interaction.guild
|
||||
if (!guild) return interaction.reply({ content: 'Je ne peux pas rejoindre ton vocal en message privé, papa !' })
|
||||
|
||||
let member = interaction.member as GuildMember
|
||||
|
||||
let botChannel = guild.members.me?.voice.channel
|
||||
let papaChannel = member.voice.channel
|
||||
|
||||
if (!papaChannel && botChannel) {
|
||||
const voiceConnection = getVoiceConnection(guild.id);
|
||||
if (voiceConnection) voiceConnection.destroy()
|
||||
return interaction.reply({ content: 'Je quitte le vocal, papa !' })
|
||||
}
|
||||
else if (papaChannel && (!botChannel || botChannel.id !== papaChannel.id)) {
|
||||
joinVoiceChannel({
|
||||
channelId: papaChannel.id,
|
||||
guildId: papaChannel.guild.id,
|
||||
adapterCreator: papaChannel.guild.voiceAdapterCreator,
|
||||
})
|
||||
return interaction.reply({ content: 'Je rejoins ton vocal, papa !' })
|
||||
}
|
||||
else return interaction.reply({ content: 'Je suis déjà dans ton vocal, papa !' })
|
||||
}
|
||||
}
|
||||
import { SlashCommandBuilder } from "discord.js"
|
||||
import type { ChatInputCommandInteraction, GuildMember } from "discord.js"
|
||||
import { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice"
|
||||
import { t } from "@/utils/i18n"
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName("papa")
|
||||
.setDescription("If daddy calls me, I join him")
|
||||
.setDescriptionLocalizations({ fr: "Si papa m'appelle, je le rejoins" })
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
if (interaction.user.id !== "223831938346123275") return interaction.reply({ content: t(interaction.locale, "salonpostam.papa.not_your_father") })
|
||||
|
||||
const guild = interaction.guild
|
||||
if (!guild) return interaction.reply({ content: t(interaction.locale, "salonpostam.papa.no_dm") })
|
||||
|
||||
const member = interaction.member as GuildMember
|
||||
|
||||
const botChannel = guild.members.me?.voice.channel
|
||||
const papaChannel = member.voice.channel
|
||||
|
||||
if (!papaChannel && botChannel) {
|
||||
const voiceConnection = getVoiceConnection(guild.id)
|
||||
if (voiceConnection) voiceConnection.destroy()
|
||||
return interaction.reply({ content: t(interaction.locale, "salonpostam.papa.leaving_voice") })
|
||||
} else if (papaChannel && (!botChannel || botChannel.id !== papaChannel.id)) {
|
||||
joinVoiceChannel({
|
||||
channelId: papaChannel.id,
|
||||
guildId: papaChannel.guild.id,
|
||||
adapterCreator: papaChannel.guild.voiceAdapterCreator,
|
||||
})
|
||||
return interaction.reply({ content: t(interaction.locale, "salonpostam.papa.joining_voice") })
|
||||
} else return interaction.reply({ content: t(interaction.locale, "salonpostam.papa.already_connected") })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user