mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 02:37:57 -05:00
[Mod] Add two new settings to disable name/nickname tracking (#4799)
* Add default settings for name tracking * Add configuration command for name tracking * Check the track names settings before tracking * *grumble* * Fix permissions levels * Update settings.py * Use clean_prefix in inline, and don't use f-strings in `_()` Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -161,6 +161,9 @@ class Events(MixinMeta):
|
||||
@commands.Cog.listener()
|
||||
async def on_user_update(self, before: discord.User, after: discord.User):
|
||||
if before.name != after.name:
|
||||
track_all_names = await self.config.track_all_names()
|
||||
if not track_all_names:
|
||||
return
|
||||
async with self.config.user(before).past_names() as name_list:
|
||||
while None in name_list: # clean out null entries from a bug
|
||||
name_list.remove(None)
|
||||
@@ -177,6 +180,10 @@ class Events(MixinMeta):
|
||||
guild = after.guild
|
||||
if (not guild) or await self.bot.cog_disabled_in_guild(self, guild):
|
||||
return
|
||||
track_all_names = await self.config.track_all_names()
|
||||
track_nicknames = await self.config.guild(guild).track_nicknames()
|
||||
if (not track_all_names) or (not track_nicknames):
|
||||
return
|
||||
async with self.config.member(before).past_nicks() as nick_list:
|
||||
while None in nick_list: # clean out null entries from a bug
|
||||
nick_list.remove(None)
|
||||
|
||||
Reference in New Issue
Block a user