restrictions: Don't rely on role names, use role ids instead

This commit is contained in:
Ave Ozkal 2018-12-27 12:10:29 +03:00
parent 338aa80c58
commit 2b50f56fe7
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
4 changed files with 5 additions and 6 deletions

View file

@ -68,13 +68,13 @@ Main goal of this project is to get Robocop functionality done, secondary goal i
- [x] Better security, better checks and better guild whitelisting
- [ ] New verification feature: Using log module from akbbot for logging attempts and removing old attempts
- [ ] New moderation feature: mutetime (mute with time)
- [ ] New moderation feature: watch-unwatch (using log module from akbbot)
- [ ] New feature: Highlights (problematic words automatically get posted to modmail channel)
- [ ] New feature: Modmail
- [ ] New feature: Submiterr
- [ ] New moderation feature: Display of mutes on listwarns
- [ ] New moderation feature: User notes
- [ ] New moderation feature: watch-unwatch (using log module from akbbot)
- [ ] New moderation feature: mutetime (mute with time)
- [ ] New moderation feature: timelock (channel lockdown with time)
- [x] New moderation feature: Reaction removing features (thanks misson20000!)
- [x] New moderation feature: User nickname change

View file

@ -50,7 +50,7 @@ class Logs:
if str(member.id) in rsts:
roles = []
for rst in rsts[str(member.id)]:
roles.append(discord.utils.get(member.guild.roles, name=rst))
roles.append(discord.utils.get(member.guild.roles, id=rst))
await member.add_roles(*roles)
# Real hell zone.

View file

@ -79,7 +79,7 @@ class Mod:
log_channel = self.bot.get_channel(config.log_channel)
await log_channel.send(chan_message)
await ctx.send(f"{target.mention} can no longer speak.")
await self.add_restriction(target, config.mute_role_name)
await self.add_restriction(target, config.mute_role)
@commands.guild_only()
@commands.bot_has_permissions(kick_members=True)
@ -99,7 +99,7 @@ class Mod:
log_channel = self.bot.get_channel(config.log_channel)
await log_channel.send(chan_message)
await ctx.send(f"{target.mention} can now speak again.")
await self.remove_restriction(target, config.mute_role_name)
await self.remove_restriction(target, config.mute_role)
@commands.guild_only()
@commands.bot_has_permissions(kick_members=True)

View file

@ -45,4 +45,3 @@ community_channels = [526378423468425236] # Channels requiring community role
general_channels = [526372255052201995] # Channels everyone can access
mute_role = 526500080879140874 # Mute role in NotSwitched
mute_role_name = "muted" # Mute role name in NotSwitched