r3u
v2.0.7
Published
```js import { DiscordExtended } from '@iceteacorp/lib'
Downloads
12
Readme
Init & Slash command
import { DiscordExtended } from '@iceteacorp/lib'
const discord = new DiscordExtended(process.env.DISCORD_TOKEN, process.env.DISCORD_APPLICATION_ID, {
intents: ['MessageContent', 'Guilds', 'GuildMessages'],
})
// Slash command
import { PermissionFlagsBits, SlashCommandBuilder, TextChannel } from 'discord.js'
discord.setSlashCommand({
command: new SlashCommandBuilder()
.setName('rename')
.setDescription('Renommer le channel')
.addStringOption((o) => o.setName('name').setDescription('Nouveau nom').setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels)
.setDMPermission(false)
.toJSON(),
callback: async (i) => {
await i.deferReply({ ephemeral: true })
const channel = i.channel as TextChannel
await channel.setName(i.options.getString('name')!)
await i.editReply(`Le channel a été renommé en <#${channel.id}>`)
},
})
await discord.start()
OnButton() & OnMessage()
// ...
const { off } = discord.onButton({
filter: (i) => i.customId == 'btnId',
callback: async (i) => {
off()
// code
},
})
// ...
const { off } = discord.onMessage({
filter: (m) => m.author.bot == false,
callback: async (m) => {
// code
},
})