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 #128 from NabDev/dev
Browse files Browse the repository at this point in the history
v1.6.1
  • Loading branch information
Galarzaa90 committed Sep 7, 2018
2 parents a88e75b + a7487ec commit 983df3b
Show file tree
Hide file tree
Showing 174 changed files with 54 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ script:
- python -m compileall ./utils
- cp CHANGELOG.md docs/changelog.md
- python -m mkdocs build
- echo 'nabbot.xyz' > ./site/CNAME
- echo 'docs.nabbot.xyz' > ./site/CNAME

deploy:
provider: pages
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## Version 1.6.1 (2018-09-06)
- Fixed bug with /worlds
- Unified missing argument error messages
- Commands in `/help` are now sorted alphabetically

## Version 1.6.0 (2018-08-27)
- New command: `/rashid`.
- `/time` no longer displays Mexico and Brazil's timezones.
Expand Down Expand Up @@ -210,7 +215,7 @@
- Migrated many services from Tibia.com to TibiaData.com for better reliability.
- TibiaWiki database is now more recent and is now a [separate project](https://github.com/Galarzaa90/tibiawiki-sql)
- Added tons of new commands and rewrote many of them.
- Added [documentation site](https://galarzaa90.github.io/NabBot/)
- Added [documentation site](https://nabdev.github.io/NabBot/)
- And too many changes too list them here.

## Version 0.1.3 (2018-03-08)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ You can also host your own instance of NabBot.
- git

### Installing and running
Follow the [install guide](https://galarzaa90.github.io/NabBot/install/) on the official documentation site.
Follow the [install guide](https://nabdev.github.io/NabBot/install/) on the official documentation site.


## Documentation
See https://galarzaa90.github.io/NabBot/
See https://nabdev.github.io/NabBot/

## Support
Visit our support server
Expand Down
8 changes: 0 additions & 8 deletions cogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ class Admin:
def __init__(self, bot: NabBot):
self.bot = bot

async def __error(self, ctx: NabCtx, error):
if isinstance(error, commands.BadArgument):
if not error.args:
await ctx.send(f"{ctx.tick(False)} The correct syntax is: "
f"`{ctx.clean_prefix}{ctx.invoked_with} {ctx.usage}`")
else:
await ctx.send(error)

@checks.is_owner()
@checks.is_tracking_world()
@commands.command(name="addaccount", aliases=["addacc"], usage="<user>,<character>")
Expand Down
4 changes: 0 additions & 4 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ async def __error(self, ctx: NabCtx, error):
if isinstance(error, BadTime):
await ctx.send(error)
return
if isinstance(error, commands.UserInputError):
await ctx.send(f"{ctx.tick(False)} The correct syntax is: "
f"`{ctx.clean_prefix}{ctx.command.qualified_name} {ctx.usage}`.\n"
f"Try `{ctx.clean_prefix}help {ctx.command.qualified_name}` for more info.")

async def game_update(self):
"""Updates the bot's status.
Expand Down
4 changes: 1 addition & 3 deletions cogs/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,10 @@ def repl(obj):
await destination.send(page)

@commands.guild_only()
@commands.command()
@checks.can_embed()
@commands.command(usage=" ")
async def serverinfo(self, ctx: NabCtx, server=None):
"""Shows the server's information.
The bot owner can additionally check the information of a specific server where the bot is.
"""
if await checks.is_owner_check(ctx) and server is not None:
try:
Expand Down
18 changes: 9 additions & 9 deletions cogs/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def ignore_list(self, ctx: NabCtx):
await ctx.send(e)

@commands.command()
@checks.is_mod_somewhere()
@checks.is_channel_mod_somewhere()
async def makesay(self, ctx: NabCtx, *, message: str):
"""Makes the bot say a message.
Expand All @@ -104,6 +104,7 @@ async def makesay(self, ctx: NabCtx, *, message: str):
If it's used on a private message, the bot will ask on which channel he should say the message.
Each channel in the list is numerated, by choosing a number, the message will be sent in the chosen channel.
You can only send messages on channels where you have `Manage Channel` permissions.
"""
if ctx.is_private:
description_list = []
Expand All @@ -121,7 +122,8 @@ async def makesay(self, ctx: NabCtx, *, message: str):
author_permissions = author.permissions_in(channel)
bot_permissions = bot_member.permissions_in(channel)
# Check if both the author and the bot have permissions to send messages and add channel to list
if author_permissions.send_messages and bot_permissions.send_messages:
if author_permissions.send_messages and bot_permissions.send_messages \
and author_permissions.manage_channels:
separator = ""
if prev_server is not server:
separator = "---------------\n\t"
Expand All @@ -131,7 +133,7 @@ async def makesay(self, ctx: NabCtx, *, message: str):
prev_server = server
num += 1
if len(description_list) < 1:
await ctx.send("We don't have any channels where we both can send messages.")
await ctx.send("We don't have any channels where we both can send messages and that you manage.")
return
await ctx.send("Choose a channel for me to send your message (number only): \n\t0: *Cancel*\n\t" +
"\n\t".join(["{0}".format(i) for i in description_list]))
Expand All @@ -154,6 +156,10 @@ def check(m):
except asyncio.TimeoutError:
await ctx.send("... are you there? Fine, nevermind!")
else:
if not ctx.bot_permissions.manage_messages:
return await ctx.send(f"{ctx.tick(False)} I need `Manage Messages` permission to use this command.")
if not ctx.author_permissions.manage_channels:
return await ctx.send(f"{ctx.tick(False)} You need `Manage Channel` permission to use this command.")
await ctx.message.delete()
await ctx.channel.send(message)

Expand Down Expand Up @@ -215,12 +221,6 @@ async def unregistered(self, ctx: NabCtx):
except CannotPaginate as e:
await ctx.send(e)

@ignore.error
@unignore.error
async def ignore_error(self, ctx, error):
if isinstance(error, commands.errors.BadArgument):
await ctx.send(error)

def reload_ignored(self):
"""Refresh the world list from the database
Expand Down
8 changes: 2 additions & 6 deletions cogs/tibia.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def __init__(self, bot: NabBot):
self.bot = bot
self.news_announcements_task = self.bot.loop.create_task(self.scan_news())

async def __error(self, ctx: NabCtx, error):
if isinstance(error, commands.UserInputError):
await self.bot.show_help(ctx)

# Commands
@commands.command(aliases=['bless'])
async def blessings(self, ctx: NabCtx, level: int):
Expand Down Expand Up @@ -1789,9 +1785,9 @@ async def worlds(self, ctx: NabCtx, *, query=None):
try:
worlds = await get_world_list()
if worlds is None:
return await ctx.send(f"{ctx.tick(False)} Something went wrong...'")
return await ctx.send(f"{ctx.tick(False)} Something went wrong...")
except NetworkError:
return await ctx.send(f"{ctx.tick(False)} I'm having network errors, please try again later.'")
return await ctx.send(f"{ctx.tick(False)} I'm having network errors, please try again later.")
if query is None:
params = []
else:
Expand Down
6 changes: 0 additions & 6 deletions cogs/tibiawiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ class TibiaWiki:
def __init__(self, bot: NabBot):
self.bot = bot

async def __error(self, ctx, error):
if isinstance(error, commands.UserInputError):
cmd = ctx.bot.get_command('help')
command = ctx.command.qualified_name
await ctx.invoke(cmd, command=command)

# Commands
@checks.can_embed()
@commands.command(aliases=["achiev"])
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The markdown files in this folder might contain markdown not supported by GitHub
They are meant to be read from the static site generated by mkdocs.

To view online:
https://galarzaa90.github.io/NabBot/
https://nabdev.github.io/NabBot/

To view locally:
1. Install the required python modules:
Expand Down
Binary file modified docs/assets/images/commands/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/achievement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/admins_message_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/autorole_add_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/autorole_add_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/autorole_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/autorole_remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/bestiary_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/bestiary_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/bless_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/bless_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/botinfo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/checkchannel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/choose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/cleanup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/commands.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/deaths_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/deaths_mob.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/deaths_stats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/deaths_user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/diagnose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/emojiinfo_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/eval.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/event.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/event_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/commands/event_info.png
Binary file modified docs/assets/images/commands/event_join.png
Binary file modified docs/assets/images/commands/event_leave.png
Binary file modified docs/assets/images/commands/event_participants.png
Binary file modified docs/assets/images/commands/event_remove.png
Binary file modified docs/assets/images/commands/event_unsub.png
Binary file modified docs/assets/images/commands/group.png
Binary file modified docs/assets/images/commands/group_1.png
Binary file modified docs/assets/images/commands/group_2.png
Binary file modified docs/assets/images/commands/group_add.png
Binary file modified docs/assets/images/commands/group_list.png
Binary file modified docs/assets/images/commands/guild.png
Binary file modified docs/assets/images/commands/guildmembers.png
Binary file modified docs/assets/images/commands/help_1.png
Binary file modified docs/assets/images/commands/help_2.png
Binary file modified docs/assets/images/commands/help_3.png
Binary file modified docs/assets/images/commands/highscores1.png
Binary file modified docs/assets/images/commands/highscores3.png
Binary file modified docs/assets/images/commands/house_1.png
Binary file modified docs/assets/images/commands/house_2.png
Binary file modified docs/assets/images/commands/im.png
Binary file modified docs/assets/images/commands/imbuement_1.png
Binary file modified docs/assets/images/commands/imbuement_2.png
Binary file modified docs/assets/images/commands/imnot.png
Binary file modified docs/assets/images/commands/item_1.png
Binary file modified docs/assets/images/commands/item_2.png
Binary file modified docs/assets/images/commands/key.png
Binary file modified docs/assets/images/commands/key_search_1.png
Binary file modified docs/assets/images/commands/key_search_2.png
Binary file modified docs/assets/images/commands/leave.png
Binary file modified docs/assets/images/commands/levels_1.png
Binary file modified docs/assets/images/commands/levels_user.png
Binary file modified docs/assets/images/commands/load.png
Binary file modified docs/assets/images/commands/loot_input.png
Binary file modified docs/assets/images/commands/loot_legend.png
Binary file modified docs/assets/images/commands/merge.png
Binary file modified docs/assets/images/commands/monster_1.png
Binary file modified docs/assets/images/commands/monster_2.png
Binary file modified docs/assets/images/commands/news_1.png
Binary file modified docs/assets/images/commands/news_2.png
Binary file modified docs/assets/images/commands/noroles.png
Binary file modified docs/assets/images/commands/npc_1.png
Binary file modified docs/assets/images/commands/npc_2.png
Binary file modified docs/assets/images/commands/online.png
Binary file modified docs/assets/images/commands/permissions.png
Binary file modified docs/assets/images/commands/ping.png
Binary file modified docs/assets/images/commands/quote.png
Binary file modified docs/assets/images/commands/rashid.png
Binary file modified docs/assets/images/commands/reload.png
Binary file modified docs/assets/images/commands/roleinfo.png
Binary file modified docs/assets/images/commands/rolemembers.png
Binary file modified docs/assets/images/commands/roles_1.png
Binary file modified docs/assets/images/commands/roles_2.png
Binary file modified docs/assets/images/commands/roll_1.png
Binary file modified docs/assets/images/commands/roll_2.png
Binary file modified docs/assets/images/commands/roll_3.png
Binary file modified docs/assets/images/commands/searchteam_1.png
Binary file modified docs/assets/images/commands/searchteam_2.png
Binary file modified docs/assets/images/commands/searchteam_3.png
Binary file modified docs/assets/images/commands/searchworld_1.png
Binary file modified docs/assets/images/commands/searchworld_2.png
Binary file modified docs/assets/images/commands/searchworld_3.png
Binary file modified docs/assets/images/commands/searchworld_4.png
Binary file modified docs/assets/images/commands/serverinfo.png
Binary file modified docs/assets/images/commands/servers.png
Binary file modified docs/assets/images/commands/seteventschannel_1.png
Binary file modified docs/assets/images/commands/seteventschannel_2.png
Binary file modified docs/assets/images/commands/setlevelsdeathschannel_1.png
Binary file modified docs/assets/images/commands/setlevelsdeathschannel_2.png
Binary file modified docs/assets/images/commands/setwelcome_1.png
Binary file modified docs/assets/images/commands/setwelcome_2.png
Binary file modified docs/assets/images/commands/setworld_1.png
Binary file modified docs/assets/images/commands/setworld_2.png
Binary file modified docs/assets/images/commands/share_1.png
Binary file modified docs/assets/images/commands/share_2.png
Binary file modified docs/assets/images/commands/share_3.png
Binary file modified docs/assets/images/commands/share_4.png
Binary file modified docs/assets/images/commands/spell_1.png
Binary file modified docs/assets/images/commands/spell_2.png
Binary file modified docs/assets/images/commands/sql.png
Binary file modified docs/assets/images/commands/stamina_1.png
Binary file modified docs/assets/images/commands/stamina_2.png
Binary file modified docs/assets/images/commands/stats_2.png
Binary file modified docs/assets/images/commands/time.png
Binary file modified docs/assets/images/commands/time_add.png
Binary file modified docs/assets/images/commands/timeline_1.png
Binary file modified docs/assets/images/commands/unload.png
Binary file modified docs/assets/images/commands/unregistered.png
Binary file modified docs/assets/images/commands/uptime.png
Binary file modified docs/assets/images/commands/userinfo.png
Binary file modified docs/assets/images/commands/versions.png
Binary file modified docs/assets/images/commands/watched.png
Binary file modified docs/assets/images/commands/watched_add.png
Binary file modified docs/assets/images/commands/watched_guilds.png
Binary file modified docs/assets/images/commands/watched_info.png
Binary file modified docs/assets/images/commands/watched_list.png
Binary file modified docs/assets/images/commands/watched_message_1.png
Binary file modified docs/assets/images/commands/watched_remove.png
Binary file modified docs/assets/images/commands/watched_removeguild.png
Binary file modified docs/assets/images/commands/whois_1.png
Binary file modified docs/assets/images/commands/whois_2.png
Binary file modified docs/assets/images/commands/wikistats.png
Binary file modified docs/assets/images/commands/worlds_1.png
Binary file modified docs/assets/images/commands/worlds_2.png
Binary file modified docs/assets/images/commands/worlds_3.png
Binary file modified docs/assets/images/icon.png
Binary file modified images/Unknown.png
Binary file modified images/emoji/axe.png
Binary file modified images/emoji/charms.png
Binary file modified images/emoji/club.png
Binary file modified images/emoji/deathDamage.png
Binary file modified images/emoji/difficultyOff.png
Binary file modified images/emoji/difficultyOn.png
Binary file modified images/emoji/distance.png
Binary file modified images/emoji/dnd.png
Binary file modified images/emoji/energyDamage.png
Binary file modified images/emoji/experience.png
Binary file modified images/emoji/false.png
Binary file modified images/emoji/fishing.png
Binary file modified images/emoji/fist.png
Binary file modified images/emoji/iceDamage.png
Binary file modified images/emoji/idle.png
Binary file modified images/emoji/magic.png
Binary file modified images/emoji/ocurrenceOff.png
Binary file modified images/emoji/ocurrenceOn.png
Binary file modified images/emoji/offline.png
Binary file modified images/emoji/online.png
Binary file modified images/emoji/physicalDamage.png
Binary file modified images/emoji/shield.png
Binary file modified images/emoji/sword.png
Binary file modified images/emoji/true.png
Binary file modified images/emoji/warn.png
Binary file modified images/legend.png
Binary file modified images/slot.png
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ google_analytics:
extra:
social:
- type: 'github'
link: 'https://github.com/galarzaa90'
link: 'https://github.com/NabDev'
- type: 'gitlab'
link: 'https://gitlab.com/Galarzaa90'
link: 'https://gitlab.com/NabBot'
- type: 'discord'
link: 'https://discord.me/NabBot'

repo_url: https://github.com/Galarzaa90/NabBot
repo_url: https://github.com/NabDev/NabBot
edit_uri: ""
nav:
- Home: index.md
Expand Down
10 changes: 8 additions & 2 deletions nabbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self):
# A list version is created from the dictionary
self.tracked_worlds = {}
self.tracked_worlds_list = []
self.__version__ = "1.6.0"
self.__version__ = "1.6.1"
self.__min_discord__ = 1480

async def on_ready(self):
Expand Down Expand Up @@ -115,6 +115,13 @@ async def on_command_error(self, ctx: context.NabCtx, error):
await ctx.send(error)
elif isinstance(error, CannotEmbed):
await ctx.send(f"{ctx.tick(False)} Sorry, `Embed Links` permission is required for this command.")
elif isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f"{ctx.tick(False)} The correct syntax is: "
f"`{ctx.clean_prefix}{ctx.command.qualified_name} {ctx.usage}`.\n"
f"Try `{ctx.clean_prefix}help {ctx.command.qualified_name}` for more info.")
elif isinstance(error, commands.BadArgument):
await ctx.send(f"{ctx.tick(False)} {error}\n"
f"Try `{ctx.clean_prefix}help {ctx.command.qualified_name}` for more info.")
elif isinstance(error, commands.CommandInvokeError):
log.error(f"Exception in command: {ctx.message.clean_content}", exc_info=error.original)
if isinstance(error.original, discord.HTTPException):
Expand Down Expand Up @@ -160,7 +167,6 @@ async def on_guild_join(self, guild: discord.Guild):
except discord.HTTPException as e:
log.error(f"Could not send join message on server: {guild.name}.", exc_info=e)


async def on_guild_remove(self, guild: discord.Guild):
"""Called when the bot leaves a guild (server)."""
log.info("Nab Bot left server: {0.name} (ID: {0.id})".format(guild))
Expand Down
17 changes: 17 additions & 0 deletions utils/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ async def predicate(ctx):
return commands.check(predicate)


def is_channel_mod_somewhere():
"""Checks if the author has manage guild permissions in any guild"""
async def predicate(ctx):
ret = await is_owner_check(ctx)
if ret:
return True
if ctx.guild is not None:
return await check_guild_permissions(ctx, {'manage_channels': True})
for guild in ctx.bot.get_user_guilds(ctx.author.id):
member = guild.get_member(ctx.author.id)
permissions = member.guild_permissions
if permissions.administrator or permissions.manage_channels:
return True
return False
return commands.check(predicate)


def is_tracking_world():
"""Checks if the current server is tracking a tibia world
Expand Down
2 changes: 1 addition & 1 deletion utils/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ async def from_bot(cls, ctx):
def key(c):
return c.cog_name or '\u200bMisc'

entries = sorted(ctx.bot.commands, key=key)
entries = sorted(sorted(ctx.bot.commands, key=lambda c: c.name), key=key)
nested_pages = []
per_page = 10

Expand Down
5 changes: 3 additions & 2 deletions utils/tibia.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ async def get_world_list(tries=3) -> Optional[List[World]]:

worlds = []
try:
if not isinstance(json_content["worlds"], list):
if not isinstance(json_content["worlds"], dict):
return
for world in json_content["worlds"]["allworlds"]:
try:
Expand All @@ -1161,7 +1161,8 @@ async def get_world_list(tries=3) -> Optional[List[World]]:
world["online"] = 0
worlds.append(World(name=world["name"], online=world["online"], location=world["location"],
pvp_type=world["worldtype"], online_count=world["online"]))
except KeyError:
except KeyError as e:
print(e)
return
CACHE_WORLD_LIST[0] = worlds
return worlds
Expand Down

0 comments on commit 983df3b

Please sign in to comment.