Update README.md

This commit is contained in:
Jacob Nguyen
2023-08-07 17:23:58 -05:00
committed by GitHub
parent 50253ca322
commit d80081384a

View File

@@ -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");