@@ -57,31 +57,7 @@ cd botkit
57
57
> [ !NOTE] Cloning the repository creates a local copy of Botkit on your machine,
58
58
> allowing you to build your bot using the Botkit framework.
59
59
60
- ## Step 3: Set Up a Virtual Environment (Optional but Recommended)
61
-
62
- It's a good practice to use a virtual environment for your Python projects. This keeps
63
- your project dependencies isolated from your system-wide Python installation.
64
-
65
- 1 . Create a virtual environment:
66
-
67
- ``` bash
68
- python -m venv venv
69
- ```
70
-
71
- 2 . Activate the virtual environment:
72
- - On Windows:
73
- ```
74
- venv\Scripts\activate
75
- ```
76
- - On macOS and Linux:
77
- ```
78
- source venv/bin/activate
79
- ```
80
-
81
- > [!TIP] You'll know the virtual environment is active when you see `(venv)` at the
82
- > beginning of your terminal prompt.
83
-
84
- ## Step 4: Install Dependencies
60
+ ## Step 3: Install Dependencies
85
61
86
62
Install the required dependencies using PDM (Python Dependency Manager):
87
63
@@ -100,7 +76,7 @@ pdm install
100
76
> [ !NOTE] PDM will read the ` pyproject.toml ` file and install all necessary dependencies
101
77
> for Botkit.
102
78
103
- ## Step 5 : Configure Your Bot
79
+ ## Step 4 : Configure Your Bot
104
80
105
81
1 . In the root directory of your Botkit project, create a file named ` config.yml ` .
106
82
2 . Open ` config.yml ` in a text editor and add the following content:
@@ -117,7 +93,7 @@ Replace `YOUR_BOT_TOKEN_HERE` with the actual token of your Discord bot.
117
93
> [!CAUTION] Never share your bot token publicly or commit it to version control. Treat
118
94
> it like a password.
119
95
120
- # # Step 6 : Create a New Extension Folder
96
+ # # Step 5 : Create a New Extension Folder
121
97
122
98
Now, let's create a new folder for our extension :
123
99
@@ -128,7 +104,7 @@ Now, let's create a new folder for our extension:
128
104
mkdir src/extensions/my_first_extension
129
105
` ` `
130
106
131
- # # Step 7 : Create the `__init__.py` File
107
+ # # Step 6 : Create the `__init__.py` File
132
108
133
109
The `__init__.py` file is crucial for Python to recognize the directory as a package :
134
110
@@ -150,7 +126,7 @@ __all__ = ["setup", "default"]
150
126
> (which we'll create next). It allows Botkit to access these components when loading
151
127
> the extension.
152
128
153
- # # Step 8 : Create the `main.py` File
129
+ # # Step 7 : Create the `main.py` File
154
130
155
131
The `main.py` file will contain the main logic for our extension :
156
132
@@ -192,7 +168,7 @@ Let's break down what we've done here:
192
168
> [!TIP] Using type hints (like `bot: discord.Bot`) helps catch errors early and
193
169
> improves code readability. It's a good practice to use them consistently in your code.
194
170
195
- # # Step 9 : Adding Commands
171
+ # # Step 8 : Adding Commands
196
172
197
173
Now, let's add some commands to our extension. We'll create a simple "hello" command and
198
174
a more complex "userinfo" command.
@@ -240,7 +216,7 @@ Let's explain these commands:
240
216
> better user experience and are easier to discover than traditional prefix-based
241
217
> commands.
242
218
243
- # # Step 10 : Adding an Event Listener
219
+ # # Step 9 : Adding an Event Listener
244
220
245
221
Let's add an event listener to our extension to demonstrate how to respond to Discord
246
222
events. We'll add a simple listener that logs when the bot is ready.
@@ -259,7 +235,7 @@ connected to Discord.
259
235
> [!TIP] Event listeners are great for performing actions based on Discord events, such
260
236
> as when a member joins a server or when a message is deleted.
261
237
262
- # # Step 11 : Final `main.py` File
238
+ # # Step 10 : Final `main.py` File
263
239
264
240
Your complete `main.py` file should now look like this :
265
241
@@ -303,7 +279,7 @@ default = {
303
279
}
304
280
` ` `
305
281
306
- # # Step 12 : Running Your Bot
282
+ # # Step 11 : Running Your Bot
307
283
308
284
Now that we've created our extension, let's run the bot :
309
285
0 commit comments