Files
handler/README.md
2022-02-14 23:42:28 +05:30

98 lines
2.4 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/shandler"><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 automates and streamlines development 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
##### [Typescript](https://www.typescriptlang.org/)
```ts
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
]
});
// Access the handler anywhere
client.handler = new Sern.Handler({
client,
prefix,
commands : 'dist/commands',
privateServers : [
{
test : true,
id: 'server-id'
}
],
init: async (handler : Sern.Handler) => {
// Optional function to initialize anything else on bot startup
},
});
```
##### [JavaScript](https://www.javascript.com)
```js
import { Client, Intents } from 'discord.js';
import { Handler } 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
]
});
// Access handler anywhere
client.handler = new 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);
```
## Links ![link](https://img.shields.io/badge/Coming-Soon-purple)
- 📑 Official Documentation
- 🎧 Discord Server
## Contribute 😄
- Pull up on [issues](https://github.com/jacoobes/Sern/issues) and tell me if there are bugs
- All kinds of contributions are welcomed!