~nova/fletcher

74982878263323019dc9de5464a955386db1b958 — Novalinium a month ago b34a1a8
Dog function
1 files changed, 27 insertions(+), 0 deletions(-)

M swag.py
M swag.py => swag.py +27 -0
@@ 602,6 602,23 @@ async def azlyrics_function(message, client, args):
        await message.add_reaction("🚫")


async def dog_function(message, client, args):
    global ch
    try:
        url = args[0]
        input_image_blob = None
        file_name = None
        async with session.get("https://random.dog/woof.json") as resp:
            request_body = await resp.json()
            input_image_blob = await netcode.simple_get_image(request_body["url"])
            file_name = request_body["url"].split("/")[-1]
        return discord.File(input_image_blob, file_name)
    except Exception as e:
        exc_type, exc_obj, exc_tb = exc_info()
        logger.error("DF[{}]: {} {}".format(exc_tb.tb_lineno, type(e).__name__, e))
        await message.add_reaction("🚫")


async def vine_function(message, client, args):
    global ch
    try:


@@ 1284,6 1301,16 @@ def autoload(ch):
    )
    ch.add_command(
        {
            "trigger": ["!dog"],
            "function": dog_function,
            "async": True,
            "args_num": 0,
            "args_name": [],
            "description": "Woof!"
        }
    )
    ch.add_command(
        {
            "trigger": ["!glowup"],
            "function": partial(ttl, "https://glowfic.com"),
            "async": True,