dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
665 stars 155 forks source link

Self bot missing content (images / videos) #471

Closed berlin320 closed 1 year ago

berlin320 commented 1 year ago

Summary

I was using for cloning my one server to another, the bot used to work fine until few days back when it just stopped sending images. It works fine for messages including gifs tho.

Reproduction Steps

Still figuring it out.

Code

No response

Expected Results

import discord import json import requests

just sharing the imp part

def send_message(content, username, user_avatar, webhook): data = { "content": content, "username": username, "avatar_url": user_avatar } response = requests.post(webhook, json=data) return True

Actual Results

should send the images (content)

System Information

Running on pc / replit / heroku. Same issue all places

Checklist

Additional Information

No response

ghost commented 1 year ago

You need to check if the message has attachments.

For example:

if message.attachments:
    for attachment in message.attachments:
        send_message(content=attachment.url, username=..., user_avatar=..., webhook=...)
berlin320 commented 1 year ago

You need to check if the message has attachments.

For example:

if message.attachments:
    for attachment in message.attachments:
        send_message(content=attachment.url, username=..., user_avatar=..., webhook=...)

the bot is working for some images but not for some, I am so confused.