mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
fix: Client.start() takes no log_handler kwarg (run()-only)
log_handler belongs to Client.run() (which configures logging and then calls start()); passing it to start() raised TypeError at launch. This was inherited from the never-run dockerised variant's thin_client.py. We configure our own handlers, so simply drop the kwarg. Also set logger.propagate=False: a dependency calls logging.basicConfig(), so every 'discord' record was printed twice (our format + root's). Verified with a strict-signature stub client (start(token, *, reconnect)). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,9 @@ console_handler = logging.StreamHandler()
|
||||
console_handler.setLevel(logging.INFO)
|
||||
console_handler.setFormatter(formatter)
|
||||
logger.addHandler(console_handler)
|
||||
# Some dependency calls logging.basicConfig(), adding a root handler; without
|
||||
# this the 'discord' logger's records get printed twice (our format + root's).
|
||||
logger.propagate = False
|
||||
|
||||
# *=========================================== Initializations
|
||||
intents = discord.Intents.default()
|
||||
@@ -238,7 +241,10 @@ async def _run_bot(token: str, shutdown_event: asyncio.Event) -> None:
|
||||
docker). Now every death is diagnosed on the console first.
|
||||
"""
|
||||
try:
|
||||
await client.start(token, log_handler=None)
|
||||
# NOTE: log_handler is a Client.run()-only kwarg (run() configures
|
||||
# logging, then calls start()); start() takes just the token. We set
|
||||
# up our own handlers above, so nothing is lost.
|
||||
await client.start(token)
|
||||
except discord.LoginFailure:
|
||||
logger.critical(
|
||||
"FATAL: Discord REJECTED the token (Improper token). Fix the "
|
||||
|
||||
Reference in New Issue
Block a user