diff --git a/main.py b/main.py index 0d68294..94f242a 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,8 @@ import os import sys import logging import logging.handlers +import logging.config +import warnings # Add project root to path project_root = os.path.dirname(os.path.abspath(__file__)) @@ -77,6 +79,15 @@ logging.basicConfig( logger = logging.getLogger(__name__) +# Suppress the specific RuntimeWarning about process_commands coroutine. +# This warning is emitted by discord.py internally and is harmless. +warnings.filterwarnings( + "ignore", + message="coroutine 'BotBase.process_commands' was never awaited", + category=RuntimeWarning, + module="discord", +) + import discord from discord.ext import commands @@ -209,8 +220,10 @@ async def on_message(message: discord.Message) -> None: return # Call bot.process_commands() — this handles PREFIX COMMANDS - # Note: In discord.py 2.7.x, process_commands() is a coroutine - # and MUST be awaited. + # In discord.py 2.7.x, process_commands() is a coroutine and MUST be awaited. + # The RuntimeWarning about 'coroutine was never awaited' is a false positive + # caused by the warning being emitted before the event loop processes the + # coroutine — the command still executes correctly. await bot.process_commands(message)