2.0.7 • Published 11 months ago

r3u v2.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

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
  },
})
2.0.3

11 months ago

2.0.2

11 months ago

2.0.5

11 months ago

2.0.4

11 months ago

2.0.7

11 months ago

2.0.6

11 months ago

2.0.1

12 months ago

2.0.0

12 months ago

1.0.0

1 year ago