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

@@ -23,6 +23,7 @@ _Coming Soon_
- Slowmode now doesn't effect mods and admins of that guild.
- Fixed `blacklist` command.
- Fixed backup system because it didn't keep the backup folder there.
- Fixed `unban` command

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

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

@@ -231,11 +231,17 @@ class Admin():
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
@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:
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:
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

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


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

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


+ 1
- 1
main.py View File

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


Loading…
Cancel
Save