Skip to content

Commit

Permalink
fix to-external file bridging
Browse files Browse the repository at this point in the history
  • Loading branch information
greeeen-dev committed Sep 27, 2024
1 parent 6c42144 commit b2f48f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions revolt_bridge_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import revolt
import nextcord
from io import BytesIO
from typing import Union

class RevoltPlatform(platform_base.PlatformBase):
def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -236,8 +237,11 @@ async def to_discord_file(self, file):
filebytes = await file.read()
return nextcord.File(fp=BytesIO(filebytes), filename=file.filename, force_close=False)

async def to_platform_file(self, file):
f = await file.to_file(use_cached=True)
async def to_platform_file(self, file: Union[nextcord.Attachment, nextcord.File]):
if type(file) is nextcord.Attachment:
f = await file.to_file(use_cached=True)
else:
f = file
return revolt.File(f.fp.read(), filename=f.filename)

async def send(self, channel, content, special: dict = None):
Expand Down

0 comments on commit b2f48f8

Please sign in to comment.