Skip to content

Instantly share code, notes, and snippets.

@meister03
Last active March 11, 2022 22:05
Show Gist options
  • Save meister03/2f8697512e039f1081b16d245bbcc6df to your computer and use it in GitHub Desktop.
Save meister03/2f8697512e039f1081b16d245bbcc6df to your computer and use it in GitHub Desktop.

Migration to Discordeno/Discordeno.js

General

Events:

There are some changes on how parameters are passed on the Events:

Check this for more info: https://github.com/discordeno/discordeno/blob/main/bot.ts#L395

Channel

- parent: 'id'
+ parentId: 'id'

Create Channel

- message.guild.channels.create('channelname', {
  permissionOverwrites: [
    id: message.guild.roles.everyone,
    deny: ['VIEW_CHANNEL']
  ]
})

+ message.guild.channels.create({name: 'channelname',  
  permissionOverwrites: [
    id: message.guild.id,
    deny: ['VIEW_CHANNEL']
    type: 'role', 
  ]
})

+ client.helpers.createChannel(guildId, {
  name: 'channelname',
  permissionOverwrites: [
    id: BigInt('everyoneRoleId/guildId'),
    deny: [1n << 10n] // ['VIEW_CHANNEL']
    type: 0, 
  ],
}, reason);

Role

Permissions

Message

Embed

- const embed = new Discord.MessageEmbed()
  .setTitle('hello')
  .addField('2', '3', true)
  .setImage('url')

+ const embed = new Discord.Embed()
  .setTitle('hello')
  .addField({name: '2', value: '3', inline: true})
  .setImage('url')
  .toJSON()

+ const raw_embed = {title: 'hello', fields: [{name: '2', value: '3', inline: true}], image: {url: 'url'}}

Attachment

- const files = [{attachment:  new Buffer.from(IMAGE_BUFFER,"base64"), name: "leaderboard.png"}];
- message.channel.send({files})

+ const files = [{attachment:  [new Buffer.from(IMAGE_BUFFER,"base64")], name: "leaderboard.png"}];
+ message.channel.send({attachments: files})

+ const {Blob} = require('Buffer')
+ const files = [{attachment:  new Blob([new Buffer.from(IMAGE_BUFFER,"base64")]), name: "leaderboard.png"}];
+ client.helpers.sendMessage({file: files})

ButtonComponent

- const button = new Discord.MessageButton().setLabel(`test`).setStyle(`SUCCESS`).setCustomId(`helptest`).setEmoji('🐱');

+ const button = new Discord.Component({type: 'BUTTON'}).setLabel(`test`).setStyle(`SUCCESS`).setCustomId(`helptest`).setEmoji('🐱').toJSON();

+ const button = {type: 2, style: 3, label: 'test', customId: 'helptest', emoji: {name: '🐱'}, disabled: false}

SelectMenuComponent

-   const selectmenu = new Discord.MessageSelectMenu()
            .setCustomId(`selectItem`)
            .setMinValues(1)
            .setMaxValues(1)
            .setPlaceholder('Select the Item for getting more info')
            .addOptions(selectOptions)

+  const selectmenu = new Discord.Component({type: 'SELECT_MENU'})
            .setCustomId(`selectItem`)
            .setMinValues(1)
            .setMaxValues(1)
            .setPlaceholder('Select the Item for getting more info')
            .addOptions(selectOptions)
            .toJSON()

+ const selectmenu = {type: 3, customId: 'selectItem', placeholder: 'Select the Item for getting more info', minValues: 1, maxValues: 1, options: selectOptions} //Do not forget to format the emoji in the SelectOptions as object

ActionRow Component

-  const row1 = new Discord.MessageActionRow().addComponents(button1, button2, button3);

+  const row1 = new Discord.Component({type: 'ACTION_ROW'}).addComponents(button1, button2, button3).toJSON();

+  const row1 = {type: 1, components: [button1, button2, button3]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment