Example #1
0
async def gif(message: discord.Message, text: Annotate.CleanContent):
    """ Gives a **huge** version of emojies AS A GIF. """
    images, total_width, height = await convert_to_images(text)

    # Get optional duration
    duration = 0.15

    duration_arg = text.split(" ")[-1]
    if re.match(r"[0-9.]+", duration_arg):
        duration = float(duration_arg) / 10

    frames = []
    for image in images:
        frame_bytes = utils.convert_image_object(image, format="PNG")
        frames.append(imageio.imread(frame_bytes))

    # Make a gif
    image_bytes = imageio.mimwrite(imageio.RETURN_BYTES,
                                   frames,
                                   format="GIF",
                                   duration=duration)
    await client.send_file(message.channel,
                           BytesIO(image_bytes),
                           filename="emojies.gif")
Example #2
0
async def remTag(message: discord.Message, text: Annotate.CleanContent):
    result = delfromDB(text.split(' ', 1)[0], text.split(' ', 1)[1])
    if result is 0:
        await client.say(message, "Tag removed.")
        return
    await client.say(message, "Tag doesn't exist.")