7171
7272If you want to use prefix commands, make sure to also enable the intent below in the Discord developer portal.
7373"""
74- # intents.message_content = True
74+ intents .message_content = True
7575
7676bot = Bot (command_prefix = commands .when_mentioned_or (config ["prefix" ]), intents = intents , help_command = None )
7777
@@ -132,21 +132,6 @@ async def on_message(message: discord.Message) -> None:
132132 await bot .process_commands (message )
133133
134134
135- @bot .event
136- async def on_app_command_completion (interaction : Interaction ) -> None :
137- """
138- The code in this event is executed every time an app command has been **successfully** executed
139-
140- :param interaction: The app command that has been executed.
141- """
142-
143- if interaction .guild is not None :
144- print (
145- f"Executed { interaction .data .name } app command in { interaction .guild .name } (ID: { interaction .guild .id } ) by { interaction .author } (ID: { interaction .author .id } )" )
146- else :
147- print (f"Executed { interaction .data .name } app command by { interaction .author } (ID: { interaction .author .id } ) in DMs" )
148-
149-
150135@bot .event
151136async def on_command_completion (context : Context ) -> None :
152137 """
@@ -220,7 +205,7 @@ async def on_command_error(context: Context, error) -> None:
220205 raise error
221206
222207
223- async def main () -> None :
208+ async def load_cogs () -> None :
224209 """
225210 The code in this function is executed whenever the bot will start.
226211 """
@@ -233,9 +218,8 @@ async def main() -> None:
233218 except Exception as e :
234219 exception = f"{ type (e ).__name__ } : { e } "
235220 print (f"Failed to load extension { extension } \n { exception } " )
236- await bot .start (config ["token" ])
237221
238222
239- if __name__ == "__main__" :
240- init_db ( )
241- asyncio .run (main () )
223+ init_db ()
224+ asyncio . run ( load_cogs () )
225+ bot .run (config [ "token" ] )
0 commit comments