new attempr
This commit is contained in:
@@ -107,7 +107,6 @@ class BotBase(GroupMixin):
|
||||
self.extra_events = {}
|
||||
self.__cogs = {}
|
||||
self.__extensions = {}
|
||||
self._shortcuts = {}
|
||||
self._checks = []
|
||||
self._check_once = []
|
||||
self._before_invoke = None
|
||||
@@ -134,22 +133,6 @@ class BotBase(GroupMixin):
|
||||
else:
|
||||
self.help_command = help_command
|
||||
|
||||
def add_guild_shortcut(self, name, config_dict):
|
||||
"""Add a shortcut attribute to context.guild
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
name: :class:`str`
|
||||
The name of the shortcut you want to add to context.guild
|
||||
config_dict: :class:`dict`
|
||||
The dict of {guild.id: other_data} where context.guild.<shortcut> will get the data from
|
||||
"""
|
||||
if not isinstance(name, str):
|
||||
raise ValueError("Name must be a string")
|
||||
if not isinstance(config_dict, dict):
|
||||
raise ValueError("config_dict must be a dict")
|
||||
self._shortcuts[name] = config_dict
|
||||
|
||||
@property
|
||||
def owner(self):
|
||||
""":class:`discord.User`: The owner, retrieved from owner_id. In case of improper caching, this can return None
|
||||
|
@@ -227,11 +227,7 @@ class Context(discord.abc.Messageable):
|
||||
@discord.utils.cached_property
|
||||
def guild(self):
|
||||
"""Optional[:class:`.Guild`]: Returns the guild associated with this context's command. None if not available."""
|
||||
guild = self.message.guild
|
||||
if self.bot._shortcuts:
|
||||
for name, config in self.bot._shortcuts.items():
|
||||
setattr(guild, name, config.get(guild.id))
|
||||
return guild
|
||||
return self.message.guild
|
||||
|
||||
@discord.utils.cached_property
|
||||
def channel(self):
|
||||
|
Reference in New Issue
Block a user