|
24 | 24 |
|
25 | 25 | from __future__ import annotations # will probably need in future for type hinting |
26 | 26 | import asyncio |
| 27 | +import collections |
| 28 | +import inspect |
27 | 29 | import traceback |
28 | 30 | from .app.errors import ApplicationCommandError, CheckFailure |
29 | 31 |
|
@@ -354,12 +356,29 @@ class be provided, it must be similar enough to |
354 | 356 |
|
355 | 357 | class BotBase(ApplicationCommandMixin, CogMixin): |
356 | 358 | # TODO I think |
357 | | - def __init__(self, *args, **kwargs): |
| 359 | + def __init__(self, description=None, *args, **options): |
358 | 360 | # super(Client, self).__init__(*args, **kwargs) |
359 | 361 | # I replaced ^ with v and it worked |
360 | | - super().__init__(*args, **kwargs) |
361 | | - self.debug_guild = kwargs.pop("debug_guild", None) |
362 | | - self.debug_guilds = kwargs.pop("debug_guilds", None) |
| 362 | + super().__init__(*args, **options) |
| 363 | + self.extra_events = {} # TYPE: Dict[str, List[CoroFunc]] |
| 364 | + self.__cogs = {} # TYPE: Dict[str, Cog] |
| 365 | + self.__extensions = {} # TYPE: Dict[str, types.ModuleType] |
| 366 | + self._checks = [] # TYPE: List[Check] |
| 367 | + self._check_once = [] |
| 368 | + self._before_invoke = None |
| 369 | + self._after_invoke = None |
| 370 | + self.description = inspect.cleandoc(description) if description else '' |
| 371 | + self.owner_id = options.get('owner_id') |
| 372 | + self.owner_ids = options.get('owner_ids', set()) |
| 373 | + |
| 374 | + self.debug_guild = options.pop("debug_guild", None) # TODO: remove or reimplement |
| 375 | + self.debug_guilds = options.pop("debug_guilds", None) |
| 376 | + |
| 377 | + if self.owner_id and self.owner_ids: |
| 378 | + raise TypeError('Both owner_id and owner_ids are set.') |
| 379 | + |
| 380 | + if self.owner_ids and not isinstance(self.owner_ids, collections.abc.Collection): |
| 381 | + raise TypeError(f'owner_ids must be a collection not {self.owner_ids.__class__!r}') |
363 | 382 |
|
364 | 383 | if self.debug_guild: |
365 | 384 | if self.debug_guilds is None: |
|
0 commit comments