imaginaryfriend/src/handler/commands/meow.py

16 lines
416 B
Python
Raw Normal View History

2017-04-16 15:35:12 +02:00
from .base import Base
from urllib.request import build_opener, HTTPRedirectHandler
class Meow(Base):
name = 'meow'
aliases = [':3', '=3']
@staticmethod
def execute(bot, command):
opener = build_opener(HTTPRedirectHandler)
request = opener.open('http://thecatapi.com/api/images/get?format=src')
url = request.url
bot.send_photo(chat_id=command.chat_id, photo=url)