mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
feat: Updated Readme design
This commit is contained in:
54
README.md
54
README.md
@@ -20,52 +20,7 @@ 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
|
||||
]
|
||||
});
|
||||
|
||||
new Sern.Handler({
|
||||
client,
|
||||
prefix,
|
||||
commands : 'dist/commands', // If using typescript, target your outDir/~
|
||||
privateServers : [
|
||||
{
|
||||
test : true,
|
||||
id: 'server-id'
|
||||
}
|
||||
],
|
||||
init: async (handler : Sern.Handler) => {
|
||||
// Optional function to initialize anything else on bot startup
|
||||
},
|
||||
});
|
||||
```
|
||||
#### `ping.ts`
|
||||
```ts
|
||||
import { Sern, Types } from "sern-handler";
|
||||
import { Ok } from "ts-results";
|
||||
|
||||
export default {
|
||||
alias: [],
|
||||
desc : "ping pong",
|
||||
visibility : "private",
|
||||
test : false,
|
||||
type: Sern.CommandType.SLASH | Sern.CommandType.TEXT,
|
||||
execute : async ({message, interaction} : Types.Context, args: Ok<string> ) => Ok("pong!")
|
||||
|
||||
} as Sern.Module;
|
||||
```
|
||||
|
||||
#### [JavaScript](https://www.javascript.com)
|
||||
#### ` index.js `
|
||||
```js
|
||||
import { Client, Intents } from 'discord.js';
|
||||
import { Sern } from 'sern-handler';
|
||||
@@ -97,7 +52,8 @@ new Sern.Handler({
|
||||
|
||||
client.login(token);
|
||||
```
|
||||
#### `ping.js`
|
||||
|
||||
#### ` ping.js `
|
||||
```js
|
||||
import { Sern, Types } from "sern-handler";
|
||||
import { Ok } from "ts-results";
|
||||
@@ -113,12 +69,14 @@ export default {
|
||||
};
|
||||
```
|
||||
|
||||
See [documentation](https://sernhandler.js.org) for TypeScript examples and more
|
||||
|
||||
## Links 
|
||||
|
||||
- 📑 Official Documentation
|
||||
- 🎧 Discord Server
|
||||
|
||||
## Contribute 😄
|
||||
## Contribute
|
||||
|
||||
- Pull up on [issues](https://github.com/jacoobes/Sern/issues) and tell me if there are bugs
|
||||
- All kinds of contributions are welcomed!
|
||||
|
||||
Reference in New Issue
Block a user