cat image command
parent
abebd84871
commit
b6d1083040
10
bot.py
10
bot.py
|
@ -208,6 +208,16 @@ async def birb(ctx):
|
|||
url="http://random.birb.pw/img/{}".format(json.loads(birb_contents)["file"])
|
||||
await ctx.send(embed=imgfun(msg, url))
|
||||
|
||||
@bot.command(aliases=['kitty', 'kitti'])
|
||||
async def cat(ctx):
|
||||
with urlopen(Request(url="http://aws.random.cat/meow", headers={'User-Agent': 'Mozilla/5.0'})) as json_return:
|
||||
# get image filename
|
||||
cat_contents = json_return.read()
|
||||
msg="{0}, here is your random cat:".format(ctx.message.author.name)
|
||||
# insert image filename into URL
|
||||
url=json.loads(cat_contents)["file"]
|
||||
await ctx.send(embed=imgfun(msg, url))
|
||||
|
||||
@bot.command(aliases=['latency'])
|
||||
async def ping(ctx):
|
||||
await ctx.send("`Bot latency: {}s`".format(round(bot.latency, 2)))
|
||||
|
|
Loading…
Reference in New Issue