Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lehuyh/slasho
A lightweight framework to build modern discord.js bots with as little boilerplate as possible 🤖
https://github.com/lehuyh/slasho
boilerplate bot bot-framework discord discordjs framework nodejs slash-commands typescript
Last synced: 3 days ago
JSON representation
A lightweight framework to build modern discord.js bots with as little boilerplate as possible 🤖
- Host: GitHub
- URL: https://github.com/lehuyh/slasho
- Owner: LehuyH
- License: mit
- Created: 2021-09-07T00:09:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-21T07:11:32.000Z (over 2 years ago)
- Last Synced: 2024-11-13T23:07:15.771Z (3 days ago)
- Topics: boilerplate, bot, bot-framework, discord, discordjs, framework, nodejs, slash-commands, typescript
- Language: TypeScript
- Homepage: https://lehuyh.github.io/slasho/
- Size: 458 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> ⚠️ **Slasho is under heavy development**: Expect changes to the underlying API as we build things out!
Slasho is a minimal framework for making Discord bots. It's for bot developers who want a clean environment with the core functionality they need to dive straight into building their bots.
[📌 Getting Started Guide](https://lehuyh.github.io/slasho/#/?id=getting-started)
**When using discord.js, developers run into a number of problems**
* A lot of boilerplate. It's not hard to write discord.js, but it can be difficult to maintain.
* Slash command testing. Developers have to setup new workflows to test slash commands.
* Lack of command/event handling utilities
* No command lifecycle utilities to setup, validate, and deploy commands**Slasho** is here to fix all of these problems!
## Features
* Uses modern Discord APIs and supports slash commands out of the box
* No learning curve. Slasho builds on top of discord.js and works well with existing logic
* Single-file commands/events, just create new files to extend the bot's functionality
* Introduces command lifecycle utilities like init and validate
* Slash command deployment for development and production cases
* Shared state across commands## Installation
Use the package manager [npm](https://www.npmjs.com/package/discord-slasho) to install slasho.
```bash
npm install discord-slasho
```## How it works
Here's a very basic example of what a command in Slasho looks like
```ts
/* ./commands/ping.ts */
import { CommandInteraction } from "discord.js";
import { Command } from "discord-slasho";export default {
//Command metadata
type: "slash",
name: "ping",
description: "ping pong!",
//Options that you want discord to collect
options: [
{
name: "user",
description: "User to ping pong!",
type: "USER",
required: true,
},
],
//Main execution function, see Command Life Cycle in docs for more info
execute({ interaction }) {
interaction.reply(` 🏓 ${interaction.options.getUser("user").username}`);
},
} as Command;
```
**📚 Please check out [the docs](https://lehuyh.github.io/slasho/#/) for more information.**## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Make sure to lint 😉Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)