Browse Source

fixed unban command and fixed checking for blacklist command

tags/v1.6.1
Roxie Gibson 6 years ago
parent
commit
a4bb09d16e
5 changed files with 14 additions and 7 deletions
  1. +1
    -0
      README.md
  2. +10
    -4
      Roxbot/cogs/admin.py
  3. +1
    -1
      Roxbot/cogs/customcommands.py
  4. +1
    -1
      Roxbot/cogs/twitch.py
  5. +1
    -1
      main.py

+ 1
- 0
README.md View File

- Slowmode now doesn't effect mods and admins of that guild. - Slowmode now doesn't effect mods and admins of that guild.
- Fixed `blacklist` command. - Fixed `blacklist` command.
- Fixed backup system because it didn't keep the backup folder there. - Fixed backup system because it didn't keep the backup folder there.
- Fixed `unban` command


#### v1.6.0 #### v1.6.0
###### New Features ###### New Features

+ 10
- 4
Roxbot/cogs/admin.py View File

@commands.has_permissions(ban_members=True) @commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True) @commands.bot_has_permissions(ban_members=True)
@bot.command() @bot.command()
async def unban(self, ctx, member:discord.Member, *, reason = ""):
"""Unbans mentioned user. Allows you to give a reason."""
async def unban(self, ctx, member_id:int, *, reason = ""):
"""Unbans user with given ID. Allows you to give a reason."""
mem = None
for ban in await ctx.guild.bans():
if ban.user.id == member_id:
mem = ban.user
if mem is None:
raise bot.CommandError("User not found in bans.")
try: try:
await member.unban(reason=reason)
return await ctx.send("Unbanned {} with reason: '{}'".format(member, reason))
await ctx.guild.unban(mem, reason=reason)
return await ctx.send("Unbanned {} with reason: '{}'".format(mem, reason))
except discord.Forbidden: except discord.Forbidden:
return await ctx.send("I can't kick the owner or users higher or equal to me.") return await ctx.send("I can't kick the owner or users higher or equal to me.")



+ 1
- 1
Roxbot/cogs/customcommands.py View File

def blacklisted(user): def blacklisted(user):
with open("Roxbot/blacklist.txt", "r") as fp: with open("Roxbot/blacklist.txt", "r") as fp:
for line in fp.readlines(): for line in fp.readlines():
if user.id+"\n" == line:
if str(user.id)+"\n" == line:
return True return True
return False return False



+ 1
- 1
Roxbot/cogs/twitch.py View File

def blacklisted(user): def blacklisted(user):
with open("Roxbot/blacklist.txt", "r") as fp: with open("Roxbot/blacklist.txt", "r") as fp:
for line in fp.readlines(): for line in fp.readlines():
if user.id+"\n" == line:
if str(user.id)+"\n" == line:
return True return True
return False return False



+ 1
- 1
main.py View File

def blacklisted(user): def blacklisted(user):
with open("Roxbot/blacklist.txt", "r") as fp: with open("Roxbot/blacklist.txt", "r") as fp:
for line in fp.readlines(): for line in fp.readlines():
if user.id+"\n" == line:
if str(user.id)+"\n" == line:
return True return True
return False return False



Loading…
Cancel
Save