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,37 +1,39 @@
|
||||
import { SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, TextChannel, PermissionFlagsBits } from 'discord.js'
|
||||
import { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits, ChannelType } from "discord.js"
|
||||
import type { ChatInputCommandInteraction } from "discord.js"
|
||||
import { t } from "@/utils/i18n"
|
||||
import { logConsole } from "@/utils/console"
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('boost')
|
||||
.setDescription('Tester le boost du serveur !')
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
if (interaction.guild?.id !== '796327643783626782') return interaction.reply({ content: 'Non !' })// Jujul Community
|
||||
let member = interaction.member
|
||||
if (!member) return console.log(`\u001b[1;31m Aucun membre trouvé !`)
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName("boost")
|
||||
.setDescription("Test the server boost")
|
||||
.setDescriptionLocalizations({ fr: "Tester le boost du serveur" })
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
|
||||
let guild = interaction.guild
|
||||
if (!guild) return console.log(`\u001b[1;31m Aucun serveur trouvé !`)
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
if (interaction.guild?.id !== "796327643783626782") return interaction.reply({ content: t(interaction.locale, "boost.not_authorized") }) // Jujul Community
|
||||
|
||||
let channel = guild.channels.cache.get('924353449930412153') as TextChannel
|
||||
if (!channel) return console.log(`\u001b[1;31m Aucun channel trouvé avec l'id "924353449930412153" !`)
|
||||
const member = interaction.member
|
||||
if (!member) { logConsole('discordjs', 'boost.no_member'); return }
|
||||
|
||||
let boostRole = guild.roles.premiumSubscriberRole
|
||||
if (!boostRole) return console.log(`\u001b[1;31m Aucun rôle de boost trouvé !`)
|
||||
const guild = interaction.guild
|
||||
if (!guild.members.me) { logConsole('discordjs', 'boost.not_in_guild'); return }
|
||||
|
||||
if (!guild.members.me) return console.log(`\u001b[1;31m Je ne suis pas sur le serveur !`)
|
||||
|
||||
let embed = new EmbedBuilder()
|
||||
.setColor(guild.members.me.displayHexColor)
|
||||
.setTitle(`Nouveau boost de ${member.user.username} !`)
|
||||
.setDescription(`
|
||||
Merci à toi pour ce boost.\n
|
||||
Grâce à toi, on a atteint ${guild.premiumSubscriptionCount} boosts !
|
||||
`)
|
||||
.setThumbnail(member.user.avatar)
|
||||
.setTimestamp(new Date())
|
||||
|
||||
await channel.send({ embeds: [embed] })
|
||||
await interaction.reply({ content: 'Va voir dans <#924353449930412153> !' })
|
||||
const channel = await guild.channels.fetch("924353449930412153")
|
||||
if (!channel || (channel.type !== ChannelType.GuildText && channel.type !== ChannelType.GuildAnnouncement)) {
|
||||
logConsole('discordjs', 'boost.no_channel', { channelId: "924353449930412153" })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const boostRole = guild.roles.premiumSubscriberRole
|
||||
if (!boostRole) { logConsole('discordjs', 'boost.no_boost_role'); return }
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(guild.members.me.displayHexColor)
|
||||
.setTitle(t(interaction.locale, "boost.new_boost_title", { username: member.user.username }))
|
||||
.setDescription(t(interaction.locale, "boost.new_boost_description", { count: (guild.premiumSubscriptionCount ?? 0).toString() }))
|
||||
.setThumbnail(member.user.avatar)
|
||||
.setTimestamp(new Date())
|
||||
|
||||
await channel.send({ embeds: [embed] })
|
||||
return interaction.reply({ content: t(interaction.locale, "boost.check_channel", { channelId: "924353449930412153" }) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user