there's a part of my code, which im having problems
@client.command()
async def trap(ctx):
imgid = str(time.time())
url = nyanbase2 + 'nyazi/?token=' + nyantoken
r = requests.get(url, allow_redirects=True)
open(imgid + '.jpg', 'wb').write(r.content)
await ctx.send(file=discord.File(imgid + '.jpg'))
os.remove(imgid + '.jpg')
well, the code works awesome without any problems but the problem is about the url, it responds about 10-20 secs and job gets done about 30-90 secs. thats too much but there's no way to decrease it. theres 2 'nyanbase' api, first one is fast other one is slow.
and, if this code get triggered, everything, literally everything stops, other commands which are work instantly like
@client.command(pass_context=True)
async def naruto(ctx, *text):
imgid = str(time.time())
url = nyanbase + 'naruto/?text=' + convertTuple(text)
r = requests.get(url, allow_redirects=True)
open(imgid + '.jpg', 'wb').write(r.content)
await ctx.send(file=discord.File(imgid + '.jpg'))
os.remove(imgid + '.jpg')
aren't responding too, until the first request complete
is it possible to run those codes without stopping the whole code? because, it stops everything, bot even goes offline