@@ -29,27 +29,27 @@ def create_premade_embed(title: str, description: str) -> ErrorEmbed:
29
29
return embed
30
30
31
31
32
+ def build_cooldown_embed (error : commands .CommandOnCooldown ) -> ErrorEmbed :
33
+ embed = ErrorEmbed ()
34
+ embed .timestamp = discord .utils .utcnow ()
35
+ embed .title = "Command On Cooldown"
36
+ embed .description = (
37
+ f"This command is on cooldown. Try again in { error .retry_after :.2f} s"
38
+ )
39
+ return embed
40
+
41
+
32
42
async def send_error_embed (ctx : commands .Context , error : commands .CommandError ) -> None :
33
- if isinstance (error , commands .CommandInvokeError ) or isinstance (
43
+ if isinstance (error , commands .CommandOnCooldown ):
44
+ await ctx .send (embed = build_cooldown_embed (error ))
45
+ elif isinstance (error , commands .CommandInvokeError ) or isinstance (
34
46
error , commands .HybridCommandError
35
47
):
36
48
await ctx .send (embed = produce_error_embed (error ))
37
- elif isinstance (error , commands .CommandNotFound ):
38
- await ctx .send (
49
+ elif isinstance (error , commands .NoPrivateMessage ):
50
+ await ctx .author . send (
39
51
embed = create_premade_embed (
40
- "Command not found" ,
41
- "The command you were looking for could not be found" ,
42
- )
43
- )
44
- elif isinstance (error , commands .NotOwner ):
45
- # Basically completely silence it making people not know what happened
46
- return
47
- elif isinstance (error , commands .MissingPermissions ):
48
- missing_perms = ", " .join (error .missing_permissions ).rstrip ("," )
49
- await ctx .send (
50
- embed = create_premade_embed (
51
- "Missing Permissions" ,
52
- f"You are missing the following permissions: { missing_perms } " ,
52
+ "Guild Only" , "This command cannot be used in private messages"
53
53
)
54
54
)
55
55
elif isinstance (error , commands .MissingRequiredArgument ):
@@ -59,5 +59,3 @@ async def send_error_embed(ctx: commands.Context, error: commands.CommandError)
59
59
f"You are missing the following argument(s): { error .param .name } " ,
60
60
)
61
61
)
62
- else :
63
- await ctx .send (embed = produce_error_embed (error ))
0 commit comments