Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading files via webhook only shows embed payload #152

Open
elmoiv opened this issue May 29, 2024 · 0 comments
Open

Uploading files via webhook only shows embed payload #152

elmoiv opened this issue May 29, 2024 · 0 comments

Comments

@elmoiv
Copy link

elmoiv commented May 29, 2024

Files uploaded via webhook with embedded payload suddenly stopped showing the file in the message for no apparent reason.

  • Uploaded file type: .7z
  • The code used:
from discord_webhook import DiscordWebhook

def upload_file(fpath):  
    embeds = [
            {
                "fields": [
                    {
                        "name": "RGAC File Upload",
                        "value": 'TEST'
                    }
                ],
                "color": 0xeaddca,
                "title": "RGAC Session File",
                "image": {
                    "url": "attachment://{}".format(os.path.basename(fpath))
                },
                "footer": {
                        "text": "Captured by RGAC system"
                    },
                "thumbnail": {
                        "url": THUMB,
                    }
            }
        ]

    webhook = WEBHOOK

    wh = DiscordWebhook(
            url=webhook,
            embeds=embeds,
        )

        
    with open(fpath, "rb") as f:
        wh.add_file(file=f.read(), filename=os.path.basename(fpath))

    try:
        wh.execute()
    except:
        err = traceback.format_exc()
        print(err)
        return 1

    return 0
  • Screenshot of the message:
    IMG_20240529_061214

** The illustration is pointing to where the file was meant to be shown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant