Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #117 from Galarzaa90/dev
Browse files Browse the repository at this point in the history
1.5.0
  • Loading branch information
Galarzaa90 committed Jul 31, 2018
2 parents 296a14c + e53018b commit 97aa650
Show file tree
Hide file tree
Showing 31 changed files with 982 additions and 642 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ image: python:3.6

pages:
before_script:
- python -m pip install mkdocs mkdocs-material pymdown-extensions git+https://github.com/jdittrich/figureAltCaption.git
- python -m pip install -U -r requirements-docs.txt
script:
- cp CHANGELOG.md docs/changelog.md
- python -m mkdocs build -d public
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ matrix:

install:
- pip install -U -r requirements.txt
- pip install mkdocs mkdocs-material pymdown-extensions git+https://github.com/jdittrich/figureAltCaption.git
- pip install -U -r requirements-docs.txt

script:
- python -m compileall ./nabbot.py
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# Changelog
## Version 1.5.0 (2018-07-31)
- Small changes to `/userinfo`
- Fixed bug in `/monster` with creatures without a bestiary class defined.
- Added loading message to `/im`.
- Bot owner can now use `/serverinfo` to see other server's info.
- `/servers` now has pagination and sorting.
- NabBot now responds to a mention with its command prefixes.
- New `/emojiinfo` command
- Created new cog `Info`, moved information commands from `General`
- Level up and death messages now use lambdas for filtering.
- Server settings can now be changed with `Manage Server` permissions instead of `Administrator` permission.
- NabBot's initial message is now sent on a server channel instead of PMing the owner.

## Version 1.4.0 (2018-07-24)
- `/loot` has been rewritten:
- Loot database remade from scratch with images extracted directly from the client, all images should now be pixel perfect matches to those taken from in-game screenshots
Expand Down
25 changes: 14 additions & 11 deletions cogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from nabbot import NabBot
from utils import checks
from utils.config import config
from utils.context import NabCtx
from utils.database import *
from utils.general import join_list, log, get_user_avatar
Expand Down Expand Up @@ -43,23 +44,22 @@ async def add_account(self, ctx: NabCtx, *, params):

target = self.bot.get_member(target_name, ctx.guild)
if target is None:
await ctx.send(f"{ctx.tick(False)} I couldn't find any users named @{target_name}")
return
return await ctx.send(f"{ctx.tick(False)} I couldn't find any users named @{target_name}")
if target.bot:
await ctx.send(f"{ctx.tick(False)} You can't register characters to discord bots!")
return
return await ctx.send(f"{ctx.tick(False)} You can't register characters to discord bots!")

# Get list of the user's shared servers with the bot
target_guilds = self.bot.get_user_guilds(target.id)
# Filter only the servers that follow the same as the current context
target_guilds = list(filter(lambda x: self.bot.tracked_worlds.get(x.id) == world, target_guilds))

await ctx.trigger_typing()
msg = await ctx.send(f"{config.loading_emoji} Fetching characters...")
try:
char = await get_character(char_name)
if char is None:
await ctx.send("That character doesn't exist.")
return
return await msg.edit(content="That character doesn't exist.")
except NetworkError:
await ctx.send("I couldn't fetch the character, please try again.")
return
return await msg.edit(content="I couldn't fetch the character, please try again.")
chars = char.other_characters
# If the char is hidden,we still add the searched character, if we have just one, we replace it with the
# searched char, so we don't have to look him up again
Expand All @@ -75,7 +75,9 @@ async def add_account(self, ctx: NabCtx, *, params):
skipped.append(char)
continue
with closing(userDatabase.cursor()) as c:
c.execute("SELECT name, guild, user_id as owner, abs(level) as level FROM chars WHERE name LIKE ?",
c.execute("SELECT name, guild, user_id as owner, abs(level) as level "
"FROM chars "
"WHERE name LIKE ?",
(char.name,))
db_char = c.fetchone()
if db_char is not None:
Expand Down Expand Up @@ -274,6 +276,7 @@ async def checkchannel(self, ctx: NabCtx, *, channel: discord.TextChannel = None
"read_messages": ["error", "I won't be able to see commands in here."],
"send_messages": ["error", "I won't be able to respond in here."],
"add_reactions": ["error", "Pagination or commands that require emoji confirmation won't work."],
"external_emojis": ["warn", "I won't be able to show my emojis in some commands."],
"read_message_history": ["error", "I won't be able to see your reactions in commands."],
"manage_messages": ["warn", "Command pagination won't work well and I won't be able to delete messages "
"in the ask channel."],
Expand All @@ -286,7 +289,7 @@ async def checkchannel(self, ctx: NabCtx, *, channel: discord.TextChannel = None
if not perm_dict[k]:
ok = False
perm_name = k.replace("_", " ").title()
icon = ctx.tick(False) if level == "error" else "⚠"
icon = ctx.tick(False) if level == "error" else config.warn_emoji
content += f"\nMissing `{perm_name}` permission"
content += f"\n\t{icon} {explain}"
if ok:
Expand Down
Loading

0 comments on commit 97aa650

Please sign in to comment.