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:
15
README.md
15
README.md
@@ -77,16 +77,14 @@ export default commandModule({
|
|||||||
</details>
|
</details>
|
||||||
<details open><summary>index.ts</summary>
|
<details open><summary>index.ts</summary>
|
||||||
|
|
||||||
```ts
|
|
||||||
|
```ts
|
||||||
import { Client, GatewayIntentBits } from 'discord.js';
|
import { Client, GatewayIntentBits } from 'discord.js';
|
||||||
import { Sern, single, type Dependencies } from '@sern/handler';
|
import { Sern, single } from '@sern/handler';
|
||||||
|
|
||||||
//client has been declared previously
|
//client has been declared previously
|
||||||
|
//Version 3
|
||||||
interface MyDependencies extends Dependencies {
|
await makeDependencies({
|
||||||
'@sern/client': Singleton<Client>;
|
|
||||||
}
|
|
||||||
export const useContainer = Sern.makeDependencies<MyDependencies>({
|
|
||||||
build: root => root
|
build: root => root
|
||||||
.add({ '@sern/client': single(() => client) })
|
.add({ '@sern/client': single(() => client) })
|
||||||
});
|
});
|
||||||
@@ -96,9 +94,6 @@ Sern.init({
|
|||||||
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
|
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
|
||||||
commands: 'src/commands',
|
commands: 'src/commands',
|
||||||
// events: 'src/events' (optional),
|
// events: 'src/events' (optional),
|
||||||
containerConfig : {
|
|
||||||
get: useContainer
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login("YOUR_BOT_TOKEN_HERE");
|
client.login("YOUR_BOT_TOKEN_HERE");
|
||||||
|
|||||||
Reference in New Issue
Block a user