Merge branch 'master' of https://github.com/Phxntxm/Bonfire
This commit is contained in:
commit
c9c60464d8
3 changed files with 9 additions and 6 deletions
|
@ -1,9 +1,9 @@
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from .utils import checks
|
from .utils import checks
|
||||||
from .utils import config
|
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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} 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} 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} 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",
|
"{0} books {1} a one way ticket to Flugendorf prison",
|
||||||
"{1} was already dead",
|
"{1} was already dead",
|
||||||
"{1} was crushed under the weight of expectations",
|
"{1} was crushed under the weight of expectations",
|
||||||
|
|
|
@ -169,15 +169,18 @@ class Links:
|
||||||
|
|
||||||
await self.bot.say("Looking up an image with those tags....")
|
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:
|
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:
|
except KeyError:
|
||||||
await self.bot.say("No results with that search term, {0}!".format(ctx.message.author.mention))
|
await self.bot.say("No results with that search term, {0}!".format(ctx.message.author.mention))
|
||||||
return
|
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
|
# 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
|
# Now we can get the total count from that, and make another request based on the number of pages as well
|
||||||
|
|
Loading…
Reference in a new issue