Fully converted to slash commands

This commit is contained in:
NikolajDanger
2021-03-31 00:38:51 +02:00
parent a8a7e5eabd
commit b345720468
50 changed files with 1102 additions and 1111 deletions

View File

@ -1,20 +1,19 @@
import discord, wolframalpha, requests, os
from PIL import Image, ImageDraw, ImageFont
from funcs import logThis
class NerdShit():
def __init__(self,client):
def __init__(self, bot):
"""Runs misc commands."""
self.client = client
self.bot = bot
async def wolfSearch(self,ctx,content):
fnt = ImageFont.truetype('resources/times-new-roman.ttf', 20)
fnt = ImageFont.truetype('resources/fonts/times-new-roman.ttf', 20)
await ctx.defer()
logThis("Requesting data")
client = wolframalpha.Client(self.client.credentials.wolfKey)
res = client.query(content)
self.bot.log("Requesting data")
bot = wolframalpha.Client(self.bot.credentials.wolfKey)
res = bot.query(content)
logThis("Processing data")
self.bot.log("Processing data")
titles = []
pods = []
if int(res.numpods) > 0:
@ -73,10 +72,10 @@ class NerdShit():
wolfImage.save("resources/wolf.png")
wolfImage.close()
await ctx.send(file = discord.File("resources/wolf.png"))
await ctx.channel.send(file = discord.File("resources/wolf.png"))
os.remove("resources/wolf.png")
os.remove("resources/wolfTemp.png")
else:
logThis("No returned data")
self.bot.log("No returned data")
await ctx.send("Could not find anything relating to your search")