@@ -81,7 +81,7 @@ async def command_send_error(
8181 The constructed error message is then sent as the response to the given
8282 application command context.
8383 """
84- COMMAND_NAME : Final [ str ] = (
84+ command_name : str | None = (
8585 (
8686 ctx .command .callback .__name__
8787 if (
@@ -91,13 +91,13 @@ async def command_send_error(
9191 else ctx .command .qualified_name
9292 )
9393 if ctx .command
94- else "UnknownCommand"
94+ else None
9595 )
9696
9797 await self .send_error (
9898 self .bot ,
9999 ctx .interaction ,
100- interaction_name = COMMAND_NAME ,
100+ interaction_name = command_name ,
101101 error_code = error_code ,
102102 message = message ,
103103 logging_message = logging_message ,
@@ -108,7 +108,7 @@ async def send_error(
108108 cls ,
109109 bot : "TeXBot" ,
110110 interaction : discord .Interaction ,
111- interaction_name : str ,
111+ interaction_name : str | None ,
112112 error_code : str | None = None ,
113113 message : str | None = None ,
114114 logging_message : str | BaseException | None = None ,
@@ -128,7 +128,7 @@ async def send_error(
128128 f"{ error_code } **\n "
129129 ) + construct_error_message
130130
131- if interaction_name in cls .ERROR_ACTIVITIES :
131+ if interaction_name and interaction_name in cls .ERROR_ACTIVITIES :
132132 construct_error_message += (
133133 f" when trying to { cls .ERROR_ACTIVITIES [interaction_name ]} "
134134 )
0 commit comments