bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.11k stars 812 forks source link

REST API: support Application emojis #1567

Closed Big-Iron-Cheems closed 3 weeks ago

Big-Iron-Cheems commented 2 months ago

As of now, discordgo's restapi.go supports control of Guild based emojis, but not Application based ones. The docs related to Guild and Application emojis are located here: https://discord.com/developers/docs/resources/emoji. I am interested in supporting all the endpoints that begin with /applications/.

Screenshot below is from the https://discord.com/developers/applications/APPLICATION_ID/emojis page. image

Currently I have written this function in my personal project to GET a specific emoji by ID:

// applicationEmoji fetches an emoji from the application
func applicationEmoji(s *discordgo.Session, applicationID string, emojiID string, options ...discordgo.RequestOption) (emoji *discordgo.Emoji, err error) {
    var body []byte
    body, err = s.RequestWithBucketID("GET", discordgo.EndpointApplication(applicationID)+"/emojis/"+emojiID, nil, discordgo.EndpointApplication(applicationID), options...)
    if err != nil {
        return
    }

    err = discordgo.Unmarshal(body, &emoji)
    return
}

// Example usage in my project
emoji, err = applicationEmoji(s, applicationID, emojiID)

I am working on an implementation that is close to the Guild emoji functions. Progress tracked at this PR, suggestions appreciated.

elliotwms commented 4 weeks ago

Closed by https://github.com/bwmarrin/discordgo/pull/1566?

Big-Iron-Cheems commented 3 weeks ago

You're right, forgot to add the closes mention in the PR 👍