Skip to content
On this page

Updating from V1 to V2

Full changelog is avaiable on Github

Sheweny Client

In this new version you will find new options:

  • joinThreadsOnCreate : This option makes the bot join threads when they are created.
  • mode : This option allows to run the bot in production or development mode

The way to access the collections has to change. Instead of client.commands, client.events, client.buttons etc you should do client.collections.commands, client.collections.events, client.collections.buttons etc

Handlers

Commands handler

in version 2 the message commands and interaction commands are loaded at the same time. You no longer need the ApplicationCommandsHandler and MessagesCommandsHandler handlers but only CommandsManager.

Version 2 also supports slash-command permissions. You can use the registerPermissions function of the CommandsManager class or place the applicationPermissions: true option in the constructor.

WARNING

Actualy the permissions are only available for guilds. You can put an array of guilds ids in the function but discord no support the permissions for global commands.

Setup in client :

js
const { ShewenyClient } = require('sheweny');

const client = new ShewenyClient({
  intents: ['GUILDS'],
  managers: {
    commands: {
      directory: './commands',
      guildId: '877090306103840778', // Register commands and context-menus in this guild
      prefix: '!',
      applicationPermissions: true,
    },
  },
});

Setup with class :

js
const { ShewenyClient, CommandsManager } = require('sheweny');

const client = new ShewenyClient({ intents: ['GUILDS'] });

const commandsHandler = new CommandsManager(client, './commands', {
  prefix: '!',
});

commandsHandler.loadAll().then(() => {
  commandsHandler.registerAllApplicationCommands(client.collections.commands, '877090306103840778');
});

Inhibitors handler

The InhibitorsHandler class has been renamed to InhibitorsManager.

Events handler

The EventsHandler class has been renamed to EventsManager.

Buttons handler

The ButtonsHandler class has been renamed to ButtonsManager.

SelectMenus handler

The SelectMenusHandler class has been renamed to SelectMenusManager.

Structures

Commands

In version 2 you no longer need 2 types of structures for your orders. ApplicationCommand and MessageCommand merge to give Command

Version 2 also supports arguments for message commands thanks to a new property: args. The options property for slash-commands is kept.

It is now necessary to specify the type of command each time in the commands. The available types are : MESSAGE_COMMANDS or SLASH_COMMAND or CONTEXT_MENU_USER or CONTEXT_MENU_MESSAGE.