mirror of
https://github.com/turtlebasket/comrade-bot.git
synced 2026-03-04 19:44:27 -08:00
cat image command
This commit is contained in:
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)))
|
||||
|
||||
Reference in New Issue
Block a user