mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
92 lines
2.3 KiB
Markdown
92 lines
2.3 KiB
Markdown
# Sern Handler
|
|
<a href="https://www.npmjs.com/package/sern-handler">
|
|
<img src="https://img.shields.io/npm/v/sern_handler?maxAge=3600" alt="NPM version" /></a> <a href="https://www.npmjs.com/package/sern-handler"><img src="https://img.shields.io/npm/dt/sern_handler?maxAge=3600" alt="NPM downloads" /></a> <a href="https://www.npmjs.com/package/sern-handler"><img src="https://img.shields.io/badge/builds-stable" alt="Builds Passing"></a>
|
|
|
|
Sern can automate and streamline development of your discord bot with new version compatibility and full customization.
|
|
|
|
- A reincarnation of [this old project](https://github.com/jacoobes/sern_handler)
|
|
|
|
## Installation
|
|
|
|
```sh
|
|
npm install sern-handler
|
|
```
|
|
```sh
|
|
yarn add sern-handler
|
|
```
|
|
```sh
|
|
pnpm add sern-handler
|
|
```
|
|
|
|
## Basic Usage
|
|
|
|
#### ` index.js `
|
|
```js
|
|
import { Client, Intents } from 'discord.js';
|
|
import { Sern } from 'sern-handler';
|
|
import { prefix, token } from '../src/secrets.json';
|
|
|
|
const client = new Client({
|
|
intents: [
|
|
Intents.FLAGS.GUILDS,
|
|
Intents.FLAGS.GUILD_MESSAGES,
|
|
Intents.FLAGS.GUILD_MEMBERS
|
|
]
|
|
});
|
|
|
|
new Sern.Handler({
|
|
client,
|
|
prefix,
|
|
commands : 'dist/commands',
|
|
privateServers : [
|
|
{
|
|
test : true,
|
|
id: 'server-id'
|
|
}
|
|
],
|
|
init: async (handler) => {
|
|
// Optional function to initialize anything else on bot startup
|
|
},
|
|
});
|
|
|
|
|
|
client.login(token);
|
|
```
|
|
|
|
#### ` ping.js `
|
|
```js
|
|
import { Sern, Types } from 'sern-handler';
|
|
import { Ok } from 'ts-results';
|
|
|
|
export default {
|
|
alias: [],
|
|
desc : 'A ping pong command',
|
|
visibility : 'private',
|
|
test : false,
|
|
type: Sern.CommandType.SLASH | Sern.CommandType.TEXT,
|
|
execute : async ({ message, interaction }, args) => 'pong!'
|
|
};
|
|
```
|
|
|
|
See [documentation](https://sernhandler.js.org) for TypeScript examples and more
|
|
|
|
## Links 
|
|
|
|
- [Official Documentation](https://tmp.com)
|
|
- [Example Bot](https://tmp.com)
|
|
- [Discord Server](https://google.com)
|
|
|
|
## Contribute
|
|
|
|
- Pull up on [issues](https://github.com/jacoobes/Sern/issues) and tell us, if there are bugs
|
|
- All kinds of contributions are welcomed!
|
|
|
|
## TODO
|
|
|
|
- Default commands
|
|
- Categories
|
|
- Ruling out all bugs in the command system
|
|
- Better support for slash commands
|
|
- More Build scripts
|
|
- Logger
|