#"Task was destroyed but it is pending" spam
1 messages · Page 1 of 1 (latest)
Hey! Once your issue is solved, press the button below to close this thread!
not surer if this is a bug or what but this is the 2nd time its happened, i don't exaclty have an expalantion as to why or what happened before this occured
What's your code?
i have a lot of different extensions and stuff, im not eally sure which one caused this to happen
my most recent / most outlandish one is an auto file convert script (which isn't very good)
the code for that is
# IMPORTS
from io import BytesIO
from interactions import listen, Extension, Embed, BrandColors, File, EmbedFooter
import interactions.api.events as events
from config import DEV_GUILD, BASE_COLOR, ERR_COLOR
from src import downloader
import re
# FUNCTIONS
def Search_Content(input):
url_pattern = r"(https?://(?:www\.)?(medal\.tv|streamable\.com)/\S+)"
matches = re.findall(url_pattern, input)
return matches[0][0] if matches else None
# CLASS
class Autoconvert(Extension):
@listen(events.MessageCreate)
async def OnSend(self, event: events.MessageCreate):
Message = event.message
Url = Search_Content(Message.content)
if Url:
ReplyMessage = await Message.reply(
embeds=Embed(
title="Downloading Video!",
description=f"Please wait as we try to automatically download this video.",
color=BrandColors.YELLOW,
)
)
try:
Data = await downloader.download_video(Url)
await ReplyMessage.delete()
await Message.reply(
embeds=Embed(
title="Video Downloaded!",
description=f"Video has successfully been downloaded and can be viewed above.",
color=BASE_COLOR,
footer=EmbedFooter(
text=f"File from {Message.author.username} | Download provided by Steal Network."
),
),
file=File(BytesIO(Data), file_name="video.mp4"),
)
except Exception:
await ReplyMessage.edit(
embeds=Embed(
title="Could Not Download!",
description=f"An error occured while downloading this video.",
color=ERR_COLOR,
)
)
await ReplyMessage.delete(delay=5)
elif (
Message.attachments
and Message.attachments[0].content_type == "video/x-ms-wmv"
):
ReplyMessage = await Message.reply(
embeds=Embed(
title="Converting Video!",
description=f"Please wait as we try to automatically convert this video to a format that is playable on all devices.",
color=BrandColors.YELLOW,
)
)
try:
FinalBytes = await downloader.convert_to_mp4(Message.attachments[0].url)
await ReplyMessage.delete()
await Message.reply(
embeds=Embed(
title="Video Converted!",
description=f"Video has successfully been converted and can be viewed above.",
color=BASE_COLOR,
footer=EmbedFooter(
text=f"File from {Message.author.username} | Conversion provided by Steal Network."
),
),
file=File(FinalBytes, file_name="converted.mp4"),
)
except Exception:
await ReplyMessage.edit(
embeds=Embed(
title="Could Not Convert!",
description=f"An error occured while converting this video.",
color=ERR_COLOR,
)
)
await ReplyMessage.delete(delay=5)