reciple v8.4.0
Highlights
- CLI based handler
- Supports Context Menus
- Supports Prefix/Message commands
- Validate messsage command options
- Supports Slash Commands
- Built-in command cooldowns
- Automatically register application commands
- Highly configurable
Using Templates
To use templates use the following command in your terminal:
npm create reciple@latest
After that configure the template you want to use.
Manual Installation
To install the handler, run the following command in your terminal:
npm i reciple @reciple/core discord.js
CLI usage
Usage: reciple [options] [cwd]
Reciple is a Discord.js bot framework
Arguments:
cwd Change the current working directory
Options:
-v, --version output the version number
-t, --token <token> Replace used bot token
-c, --config <dir> Set path to a config file (default: "reciple.mjs")
-D, --debugmode Enable debug mode
-y, --yes Agree to all Reciple confirmation prompts
--env <file> .env file location
--shardmode Modifies some functionalities to support sharding
--setup Create required config without starting the bot
--cache-config <file> Add custom caching config
--sweeper-config <file> Add custom sweeper config
-h, --help display help for command
Message Commands
Reciple provides a built-in MessageCommandBuilder
class that can be used for message command handler.
import { MessageCommandBuilder } from 'reciple';
new MessageCommandBuilder()
.setName("command")
.setDescription("Your lil tiny description")
.addAliases("cmd", "cmd1")
.setExecute(command => command.message.reply("Hello!"));
Validate Message Command Options
import { MessageCommandBuilder } from 'reciple';
new MessageCommandBuilder()
.setName("command")
.setDescription("Your lil tiny description")
.addAliases("cmd", "cmd1")
.setValidateOptions(true) // Validate options
.addOption(option => option
.setName("quantity")
.setDescription("Must be a number")
.setRequired(true) // A required option
.setValidate(val => !isNaN(Number(val))) // Validate value
.setResolveValue(val => Number(val)) // Resolves the option value
)
.setExecute(async command => {
/**
* @type {number}
*/
const quantity = await data.options.getOptionValue('number', { required: true, resolveValue: true });;
await command.message.reply("Quantity: " + quantity);
});
Context Menus
Reciple provides extended ContextMenuCommandBuilder
class that can be used for context menu command handler.
import { ApplicationCommandType } from 'discord.js';
import { ContextMenuCommandBuilder } from 'reciple';
new ContextMenuCommandBuilder()
.setName("Ban")
.setType(ApplicationCommandType.User)
.setExecute(async ({ interaction }) => {
if (!interaction.inCachedGuild()) return;
await interaction.targetMember.ban();
});
Slash Commands
Reciple provides extended SlashCommandBuilder
class that can be used for slash command handler.
Read Docs
import { SlashCommandMenuBuilder } from 'reciple';
new SlashCommandBuilder()
.setName("ping")
.setDescription("Pong")
.setExecute(async ({ interaction }) => interaction.reply(`Pong!`));
Command Cooldowns
import { ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from 'reciple';
import { ApplicationCommandType } from 'discord.js';
new ContextMenuCommandBuilder()
.setName("Context Menu")
.setType(ApplicationCommandType.Message)
.setCooldown(1000 * 5) // 5 seconds cooldown
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
new MessageCommandBuilder()
.setName("message-command")
.setDescription(`Your command`)
.setCooldown(1000 * 5) // 5 seconds cooldown
.setExecute(async ({ message }) => message.reply(`Hello!`));
new SlashCommandBuilder()
.setName("slash-command")
.setDescription(`Your command`)
.setCooldown(1000 * 5) // 5 seconds cooldown
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
Config
You can configure the bot in reciple.mjs
or reciple.cjs
usually located in the bot's root directory.
Token
You can change the token in config.
token: "Your Token" // Directly set token string
token: process.env.TOKEN // Use env variable
You can override the given token as cli flag
reciple --token "YOUR_TOKEN_HERE"
reciple --token "env:TOKEN_VARIABLE"
Fun Fact
The name reciple is from a minecraft bug. The bug was a misspelling of the word
recipe
. View Mojang Bug Report
2 days ago
2 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
10 months ago
9 months ago
9 months ago
10 months ago
10 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
12 months ago
12 months ago
1 year ago
12 months ago
12 months ago
1 year ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago