diff --git a/cogs/chess.py b/cogs/chess.py index 0f66252..49989df 100644 --- a/cogs/chess.py +++ b/cogs/chess.py @@ -1,9 +1,9 @@ import discord from discord.ext import commands from .utils import checks -from .utils import config import random +import re from enum import Enum diff --git a/cogs/interaction.py b/cogs/interaction.py index d9eaa1e..4c49347 100644 --- a/cogs/interaction.py +++ b/cogs/interaction.py @@ -29,7 +29,7 @@ battle_outcomes = \ "{0} and {1} sit down for an intense game of chess, in the heat of the moment {0} forgot they were playing a game and summoned a real knight", "{0} challenges {1} to rock paper scissors, unfortunately for {1}, {0} chose scissors and stabbed them", "{0} goes back in time and becomes {1}'s best friend, winning without ever throwing a punch", - "{0} trips down some stairs on their way to the battle with {1}", + "{1} trips down some stairs on their way to the battle with {0}", "{0} books {1} a one way ticket to Flugendorf prison", "{1} was already dead", "{1} was crushed under the weight of expectations", diff --git a/cogs/links.py b/cogs/links.py index 16c3a31..3728443 100644 --- a/cogs/links.py +++ b/cogs/links.py @@ -169,15 +169,18 @@ class Links: await self.bot.say("Looking up an image with those tags....") - # Get the response from derpibooru and parse the 'search' result from it - async with self.session.get(url, params=params, headers=self.headers) as r: - data = await r.json() try: - results = data['search'] + # Get the response from derpibooru and parse the 'search' result from it + async with self.session.get(url, params=params, headers=self.headers) as r: + data = await r.json() + results = data['search'] except KeyError: await self.bot.say("No results with that search term, {0}!".format(ctx.message.author.mention)) return + except json.JSONDecodeError: + await self.bot.say("Sorry but I failed to connect to Derpibooru!") + return # The first request we've made ensures there are results # Now we can get the total count from that, and make another request based on the number of pages as well