33Description:
44This is a template to create your own discord bot in python.
55
6- Version: 5.2
6+ Version: 5.2.1
77"""
88
99import discord
@@ -24,7 +24,7 @@ def __init__(self, bot):
2424 @commands .has_permissions (kick_members = True )
2525 @checks .not_blacklisted ()
2626 @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 :
2828 """
2929 Kick a user out of the server.
3030
@@ -75,7 +75,7 @@ async def kick(self, context: Context, user: discord.User, reason: str = "Not sp
7575 @commands .has_permissions (manage_nicknames = True )
7676 @checks .not_blacklisted ()
7777 @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 :
7979 """
8080 Change the nickname of a user on a server.
8181
@@ -107,7 +107,7 @@ async def nick(self, context: Context, user: discord.User, nickname: str = None)
107107 @commands .has_permissions (ban_members = True )
108108 @checks .not_blacklisted ()
109109 @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 :
111111 """
112112 Bans a user from the server.
113113
@@ -156,7 +156,18 @@ async def ban(self, context: Context, user: discord.User, reason: str = "Not spe
156156 @commands .has_permissions (manage_messages = True )
157157 @checks .not_blacklisted ()
158158 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 )
160171
161172 @warning .command (
162173 name = "add" ,
@@ -165,7 +176,7 @@ async def warning(self, context: Context) -> None:
165176 @checks .not_blacklisted ()
166177 @commands .has_permissions (manage_messages = True )
167178 @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 :
169180 """
170181 Warns a user in his private messages.
171182
@@ -199,7 +210,7 @@ async def warning_add(self, context: Context, user: discord.User, reason: str =
199210 @checks .not_blacklisted ()
200211 @commands .has_permissions (manage_messages = True )
201212 @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 :
203214 """
204215 Warns a user in his private messages.
205216
@@ -273,7 +284,7 @@ async def purge(self, context: Context, amount: int) -> None:
273284 @commands .has_permissions (ban_members = True )
274285 @checks .not_blacklisted ()
275286 @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 :
277288 """
278289 Bans a user without the user having to be in the server.
279290
0 commit comments