mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
Update README.md
This commit is contained in:
72
README.md
72
README.md
@@ -1,4 +1,6 @@
|
|||||||
# Sern
|
# 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.
|
Sern automates and streamlines development your discord bot with new version compatibility and full customization.
|
||||||
|
|
||||||
@@ -13,40 +15,78 @@ npm install sern-handler
|
|||||||
```sh
|
```sh
|
||||||
yarn add sern-handler
|
yarn add sern-handler
|
||||||
```
|
```
|
||||||
|
```sh
|
||||||
|
pnpm add sern-handler
|
||||||
|
```
|
||||||
|
|
||||||
# Basic Usage
|
# Basic Usage
|
||||||
|
|
||||||
### [Typescript](https://www.typescriptlang.org/)
|
##### [Typescript](https://www.typescriptlang.org/)
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Client } from 'discord.js';
|
import { Client, Intents } from 'discord.js'
|
||||||
import { Intents } from 'discord.js';
|
|
||||||
import { prefix, token } from '../src/secrets.json';
|
|
||||||
import { Sern } from 'sern-handler';
|
import { Sern } from 'sern-handler';
|
||||||
|
import { prefix, token } from '../src/secrets.json';
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS],
|
intents: [
|
||||||
|
Intents.FLAGS.GUILDS,
|
||||||
|
Intents.FLAGS.GUILD_MESSAGES,
|
||||||
|
Intents.FLAGS.GUILD_MEMBERS
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
new Sern.Handler({
|
// Access the handler anywhere
|
||||||
|
client.handler = new Sern.Handler({
|
||||||
client,
|
client,
|
||||||
prefix,
|
prefix,
|
||||||
commands: 'dist/commands', // after compiling with tsc
|
commands : 'dist/commands',
|
||||||
privateServers: [
|
privateServers : [
|
||||||
{
|
{
|
||||||
test: true,
|
test : true,
|
||||||
id: 'server id',
|
id: 'server-id'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
init: async (handler: Sern.Handler) => {
|
init: async (handler : Sern.Handler) => {
|
||||||
/* An optional function to initialize anything else on bot startup */
|
// Optional function to initialize anything else on bot startup
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
##### [JavaScript](https://www.node.js.org/)
|
||||||
|
```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);
|
client.login(token);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Links 
|
## Links 
|
||||||
|
|
||||||
- 📑 Official Documentation
|
- 📑 Official Documentation
|
||||||
- 🎧 Discord Server
|
- 🎧 Discord Server
|
||||||
|
|||||||
Reference in New Issue
Block a user