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

attempt at clearing user's message embedding fails #2

Open
kepler471 opened this issue Sep 10, 2020 · 6 comments
Open

attempt at clearing user's message embedding fails #2

kepler471 opened this issue Sep 10, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@kepler471
Copy link
Owner

dvembed/handlers.go

Lines 33 to 37 in 8651edf

blank := discordgo.MessageEmbed{}
_, err = s.ChannelMessageEditEmbed(c, m.ID, &blank)
if err != nil {
log.Printf("Error removing %s's embedded v.redd.it image: %v", m.Author.Username, err)
}

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
Copy link

mija commented Feb 2, 2021

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

@kepler471
Copy link
Owner Author

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
Copy link
Owner Author

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.

@kepler471 kepler471 added the bug Something isn't working label Feb 24, 2021
@mija
Copy link

mija commented Feb 24, 2021

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
Copy link
Owner Author

kepler471 commented Feb 25, 2021

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
Copy link
Owner Author

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants