Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions interactions/client/bot.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import contextlib
import logging
import re
import sys
from asyncio import AbstractEventLoop, CancelledError, get_event_loop, iscoroutinefunction
from functools import wraps
from importlib import import_module
from importlib.util import resolve_name
from inspect import getmembers
from logging import Logger
from types import ModuleType
from typing import Any, Callable, Coroutine, Dict, List, Optional, Tuple, Union

Expand All @@ -27,7 +27,7 @@
from .models.command import ApplicationCommand, Choice, Command, Option
from .models.component import Button, Modal, SelectMenu

log: Logger = get_logger("client")
log: logging.Logger = get_logger("client")

__all__ = (
"Client",
Expand Down Expand Up @@ -58,6 +58,8 @@ class Client:
:type default_scope?: Optional[Union[int, Guild, List[int], List[Guild]]]
:param disable_sync?: Controls whether synchronization in the user-facing API should be automatic or not.
:type disable_sync?: Optional[bool]
:param debug?: Whether debug logging should be enabled
:type debug?: Optional[bool]

:ivar AbstractEventLoop _loop: The asynchronous event loop of the client.
:ivar HTTPClient _http: The user-facing HTTP connection to the Web API, as its own separate client.
Expand Down Expand Up @@ -102,6 +104,14 @@ def __init__(
]
self._default_scope = convert_list(int)(self._default_scope)

if kwargs.get("debug"):

# thx i0 for posting this on the retux Discord

_format = "%(asctime)s [%(levelname)s] - .%(funcName)s(): %(message)s"

logging.basicConfig(format=_format, level=logging.DEBUG)

if kwargs.get("disable_sync"):
self._automate_sync = False
log.warning(
Expand Down