Support for long !urban definitions

This commit is contained in:
Twentysix 2016-07-02 17:41:16 +02:00
parent 103f3d12c1
commit cb96ae10d6

View File

@ -199,7 +199,7 @@ class General:
data += "Icon: {}\n".format(server.icon_url) data += "Icon: {}\n".format(server.icon_url)
data += "```" data += "```"
await self.bot.say(data) await self.bot.say(data)
@commands.command() @commands.command()
async def urban(self, *, search_terms : str, definition_number : int=1): async def urban(self, *, search_terms : str, definition_number : int=1):
"""Urban Dictionary search """Urban Dictionary search
@ -227,8 +227,12 @@ class General:
definition = result['list'][pos]['definition'] definition = result['list'][pos]['definition']
example = result['list'][pos]['example'] example = result['list'][pos]['example']
defs = len(result['list']) defs = len(result['list'])
await self.bot.say("**Definition #{} out of {}:\n**{}\n\n" msg = ("**Definition #{} out of {}:\n**{}\n\n"
"**Example:\n**{}".format(pos+1, defs, definition, example)) "**Example:\n**{}".format(pos+1, defs, definition,
example))
msg = pagify(msg, ["\n"])
for page in msg:
await self.bot.say(page)
else: else:
await self.bot.say("Your search terms gave no results.") await self.bot.say("Your search terms gave no results.")
except IndexError: except IndexError: