🐛 Change the way defer works, so it's all done by the bot instance
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import discord, wolframalpha, requests, os
|
||||
import discord, discord_slash, wolframalpha, requests, os
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
class NerdShit():
|
||||
@ -7,8 +7,8 @@ class NerdShit():
|
||||
self.bot = bot
|
||||
|
||||
async def wolfSearch(self,ctx,content):
|
||||
await self.bot.defer(ctx)
|
||||
fnt = ImageFont.truetype('resources/fonts/times-new-roman.ttf', 20)
|
||||
await ctx.defer()
|
||||
self.bot.log("Requesting data")
|
||||
bot = wolframalpha.Client(self.bot.credentials.wolfKey)
|
||||
res = bot.query(content)
|
||||
@ -36,19 +36,19 @@ class NerdShit():
|
||||
heights = []
|
||||
for count, pod in enumerate(chunk):
|
||||
heights += [height]
|
||||
width = max(width,int(list(pod.img)[0]["@width"]))
|
||||
width = max(width,int(pod.img['@width']))
|
||||
if titleChucks[x][count] == "":
|
||||
placeForText = 0
|
||||
else:
|
||||
placeForText = 30
|
||||
height += int(list(pod.img)[0]["@height"]) + 10 + placeForText
|
||||
height += int(pod.img["@height"]) + 10 + placeForText
|
||||
|
||||
width += 10
|
||||
height += 5
|
||||
wolfImage = Image.new("RGB",(width,height),color=(255,255,255))
|
||||
|
||||
for count, pod in enumerate(chunk):
|
||||
response = requests.get(list(pod.img)[0]["@src"])
|
||||
response = requests.get(pod.img["@src"])
|
||||
file = open("resources/wolfTemp.png", "wb")
|
||||
file.write(response.content)
|
||||
file.close()
|
||||
|
Reference in New Issue
Block a user