Overview of the Sheweny framework
Sheweny is a progressive framework designed to simplify the creation of Discord bots. It features a CLI to make the framework accessible to beginners and provides streamlined methods for setting up interactions.
website·Indexed 29 days ago
https://sheweny.js.org/A framework for creating Discord bots, providing a structured way to manage commands, events, buttons, select-menus, and modals. It includes a dedicated CLI for project setup and built-in managers for handling bot interactions and inhibitors.
sheweny and shw. You can use either to execute CLI commands. To access the built-in help system, use the --help flag.sheweny --helpThe framework provides dedicated Manager classes to handle various components. These replace the previous 'Handler' system. Available managers include:
CommandsManager: Manages commands and handles ApplicationPermissions.ButtonsManager: Manages buttons.SelectMenusManager: Manages select-menus.InhibitorsManager: Manages inhibitors.interface BaseManagerOptions {
directory: string; // The main directory of the commands/files
loadAll: boolean; // Whether the framework should load all files in the directory
default: number; // The default cooldown period
}ShewenyWarning class is used to trigger warnings. In development mode, it outputs a warning to the browser console. In production mode, it emits a warn event.SelectMenu constructor, you can provide an array containing regular expressions. This allows a single listener to match multiple select-menu IDs based on a pattern.import { SelectMenu } from 'sheweny';
import type { ShewenyClient } from 'sheweny';
import type { SelectMenuInteraction } from 'discord.js';
export class SelectRegex extends SelectMenu {
constructor(client: ShewenyClient) {
super(client, [/select-[0-9]+/]); // Matches IDs like select-1, select-2, etc.
}
execute(selectMenu: SelectMenuInteraction) {
console.log(selectMenu);
}
}Button class. The constructor must call super(client, ids), where ids is an array of button IDs that this listener should handle. The execute(button) method contains the logic to run when a matching button is clicked.import { Button } from 'sheweny';
import type { ShewenyClient } from 'sheweny';
import type { ButtonInteraction } from 'discord.js';
export class Btns extends Button {
constructor(client: ShewenyClient) {
super(client, ['btnId1', 'btnId2']);
}
execute(button: ButtonInteraction) {
console.log(button);
}
}--trace-sync-io command-line flag.discord.js version 13.3.0 or higher.Loader V2 introduces several improvements to how structures are loaded:
loadFiles and readDirAndPush functions have been removed.