File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,12 @@ async def on_slash_command(interaction: ApplicationCommandInteraction) -> None:
142142 The code in this event is executed every time a slash command has been *successfully* executed
143143 :param interaction: The slash command that has been executed.
144144 """
145- print (
146- f"Executed { interaction .data .name } command in { interaction .guild .name } (ID: { interaction .guild .id } ) by { interaction .author } (ID: { interaction .author .id } )" )
145+
146+ if interaction .guild is not None :
147+ print (
148+ f"Executed { interaction .data .name } slash command in { interaction .guild .name } (ID: { interaction .guild .id } ) by { interaction .author } (ID: { interaction .author .id } )" )
149+ else :
150+ print (f"Executed { interaction .data .name } slash command by { interaction .author } (ID: { interaction .author .id } ) in DMs" )
147151
148152
149153@bot .event
@@ -215,8 +219,11 @@ async def on_command_completion(context: Context) -> None:
215219 full_command_name = context .command .qualified_name
216220 split = full_command_name .split (" " )
217221 executed_command = str (split [0 ])
218- print (
219- f"Executed { executed_command } command in { context .guild .name } (ID: { context .message .guild .id } ) by { context .message .author } (ID: { context .message .author .id } )" )
222+ if context .guild is not None :
223+ print (
224+ f"Executed { executed_command } command in { context .guild .name } (ID: { context .guild .id } ) by { context .author } (ID: { context .author .id } )" )
225+ else :
226+ print (f"Executed { executed_command } command by { context .author } (ID: { context .author .id } ) in DMs" )
220227
221228
222229@bot .event
You can’t perform that action at this time.
0 commit comments