mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
Normalize names of attributes with Config instances (#3765)
* Lets normalize how we name config attributes across the bot. Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * .... Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * nothing to see here Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
@@ -415,7 +415,7 @@ class MuteMixin(MixinMeta):
|
||||
if all(getattr(permissions, p) is False for p in new_overs.keys()):
|
||||
return False, _(mute_unmute_issues["already_muted"])
|
||||
|
||||
elif not await is_allowed_by_hierarchy(self.bot, self.settings, guild, author, user):
|
||||
elif not await is_allowed_by_hierarchy(self.bot, self.config, guild, author, user):
|
||||
return False, _(mute_unmute_issues["hierarchy_problem"])
|
||||
|
||||
old_overs = {k: getattr(overwrites, k) for k in new_overs}
|
||||
@@ -430,9 +430,7 @@ class MuteMixin(MixinMeta):
|
||||
elif e.code == 10009:
|
||||
return False, _(mute_unmute_issues["left_guild"])
|
||||
else:
|
||||
await self.settings.member(user).set_raw(
|
||||
"perms_cache", str(channel.id), value=old_overs
|
||||
)
|
||||
await self.config.member(user).set_raw("perms_cache", str(channel.id), value=old_overs)
|
||||
return True, None
|
||||
|
||||
async def unmute_user(
|
||||
@@ -444,7 +442,7 @@ class MuteMixin(MixinMeta):
|
||||
reason: str,
|
||||
) -> (bool, str):
|
||||
overwrites = channel.overwrites_for(user)
|
||||
perms_cache = await self.settings.member(user).perms_cache()
|
||||
perms_cache = await self.config.member(user).perms_cache()
|
||||
|
||||
if channel.id in perms_cache:
|
||||
old_values = perms_cache[channel.id]
|
||||
@@ -454,7 +452,7 @@ class MuteMixin(MixinMeta):
|
||||
if all(getattr(overwrites, k) == v for k, v in old_values.items()):
|
||||
return False, _(mute_unmute_issues["already_unmuted"])
|
||||
|
||||
elif not await is_allowed_by_hierarchy(self.bot, self.settings, guild, author, user):
|
||||
elif not await is_allowed_by_hierarchy(self.bot, self.config, guild, author, user):
|
||||
return False, _(mute_unmute_issues["hierarchy_problem"])
|
||||
|
||||
overwrites.update(**old_values)
|
||||
@@ -473,5 +471,5 @@ class MuteMixin(MixinMeta):
|
||||
elif e.code == 10009:
|
||||
return False, _(mute_unmute_issues["left_guild"])
|
||||
else:
|
||||
await self.settings.member(user).clear_raw("perms_cache", str(channel.id))
|
||||
await self.config.member(user).clear_raw("perms_cache", str(channel.id))
|
||||
return True, None
|
||||
|
||||
Reference in New Issue
Block a user