@iceteacorp/lib
TypeScript icon, indicating that this package has built-in type declarations

1.11.5 • Public • Published

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

/@iceteacorp/lib/

    Package Sidebar

    Install

    npm i @iceteacorp/lib

    Weekly Downloads

    3

    Version

    1.11.5

    License

    ISC

    Unpacked Size

    22.9 kB

    Total Files

    5

    Last publish

    Collaborators

    • teaiscoding