Added a grayscale image converter

Added alias for owo command (uwu is now the same thing as owo)
pull/8/head
sgoudham 4 years ago
parent e526d11dd4
commit 4eb9b5816a

@ -23,7 +23,6 @@ import urllib.parse
from typing import Optional
import discord
import pytesseract.pytesseract
from PIL import Image, ImageDraw, ImageFont
from aiohttp import request
from discord import Member, Embed
@ -362,7 +361,7 @@ class Fun(Cog):
# Send the bytes object as an image file
await ctx.send(file=discord.File(file, "homies.png"))
@command(name="owo")
@command(name="owo", aliases=["uwu"])
@cooldown(1, 1, BucketType.user)
@bot_has_permissions(manage_messages=True)
async def owo(self, ctx, *, text):
@ -378,22 +377,24 @@ class Fun(Cog):
# Send the text back
await ctx.message.channel.send(owo)
@command(name="text", hidden=True)
@cooldown(1, 1, BucketType.user)
@command(name="grayscale", aliases=["gs"])
@cooldown(1, 5, BucketType.user)
@bot_has_permissions(attach_files=True)
async def image_to_text(self, ctx):
"""Display text from an image submitted"""
pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
"""Display grayscale version of image uploaded"""
if ctx.message.attachments:
for attachments in ctx.message.attachments:
attach = await attachments.read()
image = Image.open(io.BytesIO(attach)).convert('LA')
image = Image.open(io.BytesIO(attach))
text = pytesseract.image_to_string(image)
await ctx.send(text)
# Save new grayscale image as bytes
file = io.BytesIO()
image.save(file, format='PNG')
file.seek(0)
# Send Grayscale Image
await ctx.send(file=discord.File(file, "gp.png"))
else:
await self.bot.generate_embed(ctx, desc="**Image Not Detected!**")

@ -202,9 +202,9 @@ class Info(Cog):
("Creation At", role.created_at.strftime("%a, %b %d, %Y\n%I:%M:%S %p"), True),
(f"Misc",
f"\n Mentionable?: {mentionable}" +
f"\n Hoisted?: {hoisted}" +
f"\n Managed?: {managed}", True),
f"\nMentionable?: {mentionable}" +
f"\nHoisted?: {hoisted}" +
f"\nManaged?: {managed}", True),
(f"Members ({len(role.members)})",
f"\nHumans: {len(list(filter(lambda m: not m.bot, role.members)))}" +

Loading…
Cancel
Save