kepler471 / dvembed

Discord bot to properly embed media from v.redd.it
GNU General Public License v3.0
2 stars 2 forks source link

attempt at clearing user's message embedding fails #2

Open kepler471 opened 4 years ago

kepler471 commented 4 years ago

https://github.com/kepler471/dvembed/blob/8651edf861d1a21bfbab9275f5c093f61c1122be/handlers.go#L33-L37

When a user posts a link, the link is embedded with either a reddit icon, or a preview image of the v.redd.it media. I attempted to replace the user's message embed with a blank embed but it fails.

mija commented 3 years ago

looking forward to any potential updates to this great little app btw :)

kepler471 commented 3 years ago

Don't worry work is happening :)

I have been working on the video compression, testing for a nice way to handle the larger files.

Slow progress but this issue will be fixed too, probably low priority!! Stick around ✌️

kepler471 commented 3 years ago

Error removing USER's embedded v.redd.it image: HTTP 403 Forbidden, {"message": "Cannot edit a message authored by another user", "code": 50005}

This may be a permissions issue. Try a bot with full administrator rights.

mija commented 3 years ago

Error removing USER's embedded v.redd.it image: HTTP 403 Forbidden, {"message": "Cannot edit a message authored by another user", "code": 50005}

This may be a permissions issue. Try a bot with full administrator rights.

from what i can tell the issue lies in discords api. i may be wrong but after looking through their documentation i cant find any way for a bot to remove a users embed. an alternate solution is to delete the users message entirely after the bot posts the video in the link.

kepler471 commented 3 years ago

Hmm, thanks for checking that out. I wouldn't want to delete the post, people like to see who posted it, and other's do like to click through to the original reddit thread. Reposting the user's name and the link within the bot message would also be sloppy. I may just leave this as it is then. Maybe at some point in the future they allow this functionality

kepler471 commented 3 years ago

For reference, here is the the attempt

func removeEmbed(s *discordgo.Session, m *discordgo.MessageCreate) error {
    blank := discordgo.MessageEmbed{}
    _, err := s.ChannelMessageEditEmbed(m.ChannelID, m.ID, &blank)
    return err
}