mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
Merge branch 'main' of https://github.com/jacoobes/Sern
This commit is contained in:
41
README.md
41
README.md
@@ -16,18 +16,39 @@ yarn add sern-handler
|
||||
|
||||
# Basic Usage
|
||||
|
||||
```js
|
||||
import { Sern, PayloadOptions } from 'sern-handler';
|
||||
[Typescript](https://www.typescriptlang.org/)
|
||||
```ts
|
||||
import { Client } from 'discord.js'
|
||||
import { Intents } from 'discord.js'
|
||||
import {prefix, token} from "../src/secrets.json"
|
||||
import {Sern} from "sern-handler"
|
||||
|
||||
const payload = new PayloadOptions({
|
||||
commands: '/commands', // Folder where all commands are located (subfolders supported).
|
||||
events: '/events' // Events folder directory (subfolders supported).
|
||||
owners: ['182326315813306369'], // Array of Discord ID(s).
|
||||
prefix: '/', // Prefix for your bot (if no provied then it will use /).
|
||||
client // The instance of Discord#Client().
|
||||
});
|
||||
const client = new Client({
|
||||
intents: [
|
||||
Intents.FLAGS.GUILDS,
|
||||
Intents.FLAGS.GUILD_MESSAGES,
|
||||
Intents.FLAGS.GUILD_MEMBERS
|
||||
]
|
||||
|
||||
const handler = new Sern(payload); // Create a new instance of Sern with payloads.
|
||||
})
|
||||
|
||||
new Sern.Handler( {
|
||||
client,
|
||||
prefix,
|
||||
commands : "dist/commands",
|
||||
privateServers : [
|
||||
{
|
||||
test : true,
|
||||
id: "server id"
|
||||
}
|
||||
],
|
||||
init: async (handler : Sern.Handler) => {
|
||||
/* an optional function to initialize anything else on bot startup */
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
client.login(token)
|
||||
```
|
||||
|
||||
# Links
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "sernhandler2",
|
||||
"name": "sern-handler",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sernhandler2",
|
||||
"name": "sern-handler",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user