mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2026-04-21 18:49:17 -04:00
Simplify bot class (Red) __init__ arguments, remove unused (#6714)
This commit is contained in:
@@ -9,7 +9,7 @@ Bot
|
|||||||
Red
|
Red
|
||||||
^^^
|
^^^
|
||||||
|
|
||||||
.. autoclass:: Red
|
.. autoclass:: Red()
|
||||||
:members:
|
:members:
|
||||||
:exclude-members: get_context, get_embed_color
|
:exclude-members: get_context, get_embed_color
|
||||||
|
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ def early_exit_runner(
|
|||||||
return
|
return
|
||||||
|
|
||||||
data_manager.load_basic_configuration(cli_flags.instance_name)
|
data_manager.load_basic_configuration(cli_flags.instance_name)
|
||||||
red = Red(cli_flags=cli_flags, description="Red V3", dm_help=None)
|
red = Red(cli_flags=cli_flags)
|
||||||
driver_cls = _drivers.get_driver_class()
|
driver_cls = _drivers.get_driver_class()
|
||||||
loop.run_until_complete(driver_cls.initialize(**data_manager.storage_details()))
|
loop.run_until_complete(driver_cls.initialize(**data_manager.storage_details()))
|
||||||
loop.run_until_complete(func(red, cli_flags))
|
loop.run_until_complete(func(red, cli_flags))
|
||||||
@@ -494,7 +494,7 @@ def main():
|
|||||||
|
|
||||||
data_manager.load_basic_configuration(cli_flags.instance_name)
|
data_manager.load_basic_configuration(cli_flags.instance_name)
|
||||||
|
|
||||||
red = Red(cli_flags=cli_flags, description="Red V3", dm_help=None)
|
red = Red(cli_flags=cli_flags)
|
||||||
|
|
||||||
if os.name != "nt":
|
if os.name != "nt":
|
||||||
# None of this works on windows.
|
# None of this works on windows.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
@@ -80,6 +81,8 @@ CUSTOM_GROUPS = "CUSTOM_GROUPS"
|
|||||||
COMMAND_SCOPE = "COMMAND"
|
COMMAND_SCOPE = "COMMAND"
|
||||||
SHARED_API_TOKENS = "SHARED_API_TOKENS"
|
SHARED_API_TOKENS = "SHARED_API_TOKENS"
|
||||||
|
|
||||||
|
_DEFAULT_DESCRIPTION = "Red V3"
|
||||||
|
|
||||||
log = logging.getLogger("red")
|
log = logging.getLogger("red")
|
||||||
|
|
||||||
__all__ = ("Red",)
|
__all__ = ("Red",)
|
||||||
@@ -112,7 +115,9 @@ class Red(
|
|||||||
): # pylint: disable=no-member # barely spurious warning caused by shadowing
|
): # pylint: disable=no-member # barely spurious warning caused by shadowing
|
||||||
"""Our subclass of discord.ext.commands.AutoShardedBot"""
|
"""Our subclass of discord.ext.commands.AutoShardedBot"""
|
||||||
|
|
||||||
def __init__(self, *args, cli_flags=None, bot_dir: Path = Path.cwd(), **kwargs):
|
def __init__(
|
||||||
|
self, *args: Any, cli_flags: argparse.Namespace, bot_dir: Path = Path.cwd(), **kwargs: Any
|
||||||
|
) -> None:
|
||||||
self._shutdown_mode = ExitCodes.CRITICAL
|
self._shutdown_mode = ExitCodes.CRITICAL
|
||||||
self._cli_flags = cli_flags
|
self._cli_flags = cli_flags
|
||||||
self._config = Config.get_core_conf(force_registration=False)
|
self._config = Config.get_core_conf(force_registration=False)
|
||||||
@@ -143,7 +148,7 @@ class Red(
|
|||||||
help__tagline="",
|
help__tagline="",
|
||||||
help__use_tick=False,
|
help__use_tick=False,
|
||||||
help__react_timeout=30,
|
help__react_timeout=30,
|
||||||
description="Red V3",
|
description=_DEFAULT_DESCRIPTION,
|
||||||
invite_public=False,
|
invite_public=False,
|
||||||
invite_perm=0,
|
invite_perm=0,
|
||||||
invite_commands_scope=False,
|
invite_commands_scope=False,
|
||||||
@@ -250,7 +255,13 @@ class Red(
|
|||||||
self._main_dir = bot_dir
|
self._main_dir = bot_dir
|
||||||
self._cog_mgr = CogManager()
|
self._cog_mgr = CogManager()
|
||||||
self._use_team_features = cli_flags.use_team_features
|
self._use_team_features = cli_flags.use_team_features
|
||||||
super().__init__(*args, help_command=None, tree_cls=RedTree, **kwargs)
|
super().__init__(
|
||||||
|
*args,
|
||||||
|
description=kwargs.pop("description", _DEFAULT_DESCRIPTION),
|
||||||
|
help_command=None,
|
||||||
|
tree_cls=RedTree,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
# Do not manually use the help formatter attribute here, see `send_help_for`,
|
# Do not manually use the help formatter attribute here, see `send_help_for`,
|
||||||
# for a documented API. The internals of this object are still subject to change.
|
# for a documented API. The internals of this object are still subject to change.
|
||||||
self._help_formatter = commands.help.RedHelpFormatter()
|
self._help_formatter = commands.help.RedHelpFormatter()
|
||||||
|
|||||||
@@ -172,11 +172,9 @@ def red(config_fr):
|
|||||||
|
|
||||||
cli_flags = parse_cli_flags(["ignore_me"])
|
cli_flags = parse_cli_flags(["ignore_me"])
|
||||||
|
|
||||||
description = "Red v3 - Alpha"
|
|
||||||
|
|
||||||
Config.get_core_conf = lambda *args, **kwargs: config_fr
|
Config.get_core_conf = lambda *args, **kwargs: config_fr
|
||||||
|
|
||||||
red = Red(cli_flags=cli_flags, description=description, dm_help=None, owner_ids=set())
|
red = Red(cli_flags=cli_flags)
|
||||||
|
|
||||||
yield red
|
yield red
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user