Skip to content

Commit 4b4081c

Browse files
committed
Update README.md
1 parent 42f3b87 commit 4b4081c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,39 @@ async def test(ctx: dico_command.Context):
1818

1919
bot.run()
2020
```
21+
22+
### Using Addon/module:
23+
24+
main.py:
25+
```py
26+
import dico
27+
import dico_command
28+
29+
bot = dico_command.Bot("YOUR_TOKEN_HERE", "!", intents=dico.Intents.full())
30+
bot.load_module("addons.test")
31+
bot.run()
32+
```
33+
34+
addons/test.py:
35+
```py
36+
import dico_command
37+
38+
39+
class AddonTest(dico_command.Addon, name="Addon Test"):
40+
@dico_command.command(name="addon")
41+
async def example(self, ctx: dico_command.Context):
42+
await ctx.send(f"Hello! This is addon `{self.name}`.")
43+
44+
45+
def load(bot):
46+
# Implementing function `load` is required. You may do any actions here.
47+
bot.load_addons(AddonTest)
48+
49+
50+
def unload(bot):
51+
# Implementing function `unload` is required. You may do any actions here.
52+
bot.unload_addons(AddonTest)
53+
54+
```
55+
2156
Note that using async is forced unlike dico itself.

0 commit comments

Comments
 (0)