2.0.7 • Published 1 year ago

r3u v2.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year 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

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago