3
3
Description:
4
4
This is a template to create your own discord bot in python.
5
5
6
- Version: 5.2
6
+ Version: 5.2.1
7
7
"""
8
8
9
9
import discord
@@ -24,7 +24,7 @@ def __init__(self, bot):
24
24
@commands .has_permissions (kick_members = True )
25
25
@checks .not_blacklisted ()
26
26
@app_commands .describe (user = "The user that should be kicked." , reason = "The reason why the user should be kicked." )
27
- async def kick (self , context : Context , user : discord .User , reason : str = "Not specified" ) -> None :
27
+ async def kick (self , context : Context , user : discord .User , * , reason : str = "Not specified" ) -> None :
28
28
"""
29
29
Kick a user out of the server.
30
30
@@ -75,7 +75,7 @@ async def kick(self, context: Context, user: discord.User, reason: str = "Not sp
75
75
@commands .has_permissions (manage_nicknames = True )
76
76
@checks .not_blacklisted ()
77
77
@app_commands .describe (user = "The user that should have a new nickname." , nickname = "The new nickname that should be set." )
78
- async def nick (self , context : Context , user : discord .User , nickname : str = None ) -> None :
78
+ async def nick (self , context : Context , user : discord .User , * , nickname : str = None ) -> None :
79
79
"""
80
80
Change the nickname of a user on a server.
81
81
@@ -107,7 +107,7 @@ async def nick(self, context: Context, user: discord.User, nickname: str = None)
107
107
@commands .has_permissions (ban_members = True )
108
108
@checks .not_blacklisted ()
109
109
@app_commands .describe (user = "The user that should be banned." , reason = "The reason why the user should be banned." )
110
- async def ban (self , context : Context , user : discord .User , reason : str = "Not specified" ) -> None :
110
+ async def ban (self , context : Context , user : discord .User , * , reason : str = "Not specified" ) -> None :
111
111
"""
112
112
Bans a user from the server.
113
113
@@ -156,7 +156,18 @@ async def ban(self, context: Context, user: discord.User, reason: str = "Not spe
156
156
@commands .has_permissions (manage_messages = True )
157
157
@checks .not_blacklisted ()
158
158
async def warning (self , context : Context ) -> None :
159
- pass
159
+ """
160
+ Manage warnings of a user on a server.
161
+
162
+ :param context: The hybrid command context.
163
+ """
164
+ if context .invoked_subcommand is None :
165
+ embed = discord .Embed (
166
+ title = "Error!" ,
167
+ description = "Please specify a subcommand.\n \n **Subcommands:**\n `add` - Add a warning to a user.\n `remove` - Remove a warning from a user.\n `list` - List all warnings of a user." ,
168
+ color = 0xE02B2B
169
+ )
170
+ await context .send (embed = embed )
160
171
161
172
@warning .command (
162
173
name = "add" ,
@@ -165,7 +176,7 @@ async def warning(self, context: Context) -> None:
165
176
@checks .not_blacklisted ()
166
177
@commands .has_permissions (manage_messages = True )
167
178
@app_commands .describe (user = "The user that should be warned." , reason = "The reason why the user should be warned." )
168
- async def warning_add (self , context : Context , user : discord .User , reason : str = "Not specified" ) -> None :
179
+ async def warning_add (self , context : Context , user : discord .User , * , reason : str = "Not specified" ) -> None :
169
180
"""
170
181
Warns a user in his private messages.
171
182
@@ -199,7 +210,7 @@ async def warning_add(self, context: Context, user: discord.User, reason: str =
199
210
@checks .not_blacklisted ()
200
211
@commands .has_permissions (manage_messages = True )
201
212
@app_commands .describe (user = "The user that should get their warning removed." , warn_id = "The ID of the warning that should be removed." )
202
- async def warning_add (self , context : Context , user : discord .User , warn_id : int ) -> None :
213
+ async def warning_remove (self , context : Context , user : discord .User , warn_id : int ) -> None :
203
214
"""
204
215
Warns a user in his private messages.
205
216
@@ -273,7 +284,7 @@ async def purge(self, context: Context, amount: int) -> None:
273
284
@commands .has_permissions (ban_members = True )
274
285
@checks .not_blacklisted ()
275
286
@app_commands .describe (user_id = "The user ID that should be banned." , reason = "The reason why the user should be banned." )
276
- async def hackban (self , context : Context , user_id : str , reason : str = "Not specified" ) -> None :
287
+ async def hackban (self , context : Context , user_id : str , * , reason : str = "Not specified" ) -> None :
277
288
"""
278
289
Bans a user without the user having to be in the server.
279
290
0 commit comments