andersfylling / disgord

Go module for interacting with the documented Discord's bot interface; Gateway, REST requests and voice
BSD 3-Clause "New" or "Revised" License
502 stars 71 forks source link

Add support for crossposting messages #389

Closed zspri closed 3 years ago

zspri commented 3 years ago

Is your feature request related to a problem? Please describe. I'm working on a Twitch notification system for my bot that uses disgord to send out messages to channels when a Twitch user starts streaming.

I'd like to implement a feature where the bot automatically crossposts a notification message inside announcement channels, but there doesn't seem to be a way to do this with disgord.

Describe the solution you'd like A function on Message objects that allows you to crosspost them.

Something like this:

msg, err := client.SendMsg(channelID, messageContents)
if err != nil ...

crosspostedMsg, err := msg.Crosspost()
if err != nil ...

Describe alternatives you've considered - optional Make an HTTP request via net/http and POST to the crosspost endpoint manually. However, this doesn't handle ratelimiting or update the cache.

Additional context - optional https://discord.com/developers/docs/resources/channel#crosspost-message

andersfylling commented 3 years ago

Let me know if there are any issues with this commit. From what I can tell it seems to be alright.

zspri commented 3 years ago

LGTM! Thanks for implementing it so quickly.