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
Add CreateMessageDetailed and support for Discord native replies #64
Conversation
Actually, this approach is quite flawed. The reason being that replies and sending files, or replies and sending embeds aren't mutually exclusive -- you could have any of I'm struggling to think of a smooth approach to this problem, would anyone help me out in thinking? |
Very detailed, awesome! You're right to bring up the complexity of messages. There's more flexibility than this library API provides. I went with 3 separate functions because it was simple to implement. A unified |
Alright, I'll try implement a Should I tuple all the various options to pass into CreateMessageDetailed, or? |
My intuition was that (ChannelId, MessageId) was one thing, but it's pretty weak justification. Tryout the type with a lot of args, and also an ADT like
|
- Tested replies, some allowed-mention fields, and tts - Untested: file upload, embed, and user/role id allowed-mentions
Previously removed because it was annoying ;)
I've got something working, took a few tries. I still need to thoroughly look through and see everything is working, but here's an example message sent using the new
let opts = def { R.messageDetailedContent = "Pong! @everyone"
, R.messageDetailedTTS = True
, R.messageDetailedAllowedMentions = Just $ def { R.mentionEveryone = False
, R.mentionRepliedUser = False}
, R.messageDetailedReference = Just $ def { referenceMessageId = Just $ messageId m}
}
_ <- restCall (R.CreateMessageDetailed (messageChannel m) opts) I defined a new |
I like the detailed ADT for |
Thanks! I've manually tested things to the best of my ability now, so it's ready for review/merge! |
👍 |
Discord introduced their native "reply" feature a while back. It seems like cross-posted messages from news channels also use the same format. I thought I'd take a go at implementing it in
discord-haskell
.This pull request adds the functionality to create messages with manual controls via
R.CreateMessageDetailed
, and also adds support for native replies on the way.Changes:
messageReference
andreferencedMessage
fields in the Message type, as per the docs.Maybe MessageReference
(expanded below) of the original message if it exists.Maybe Message
of the full original message (only present in Replies; Therefore messageReference does not imply the presence of referencedMessage)MessageReference
type, following the Discord API object of the same name.MessageId
,ChannelId
, and optionalGuildId
of the referenced message.referencedMessage
does not exist, e.g. for crossposted news messagesCreateMessageDetailed
. Granular controls to send a message. Backwards compatible due to separate name.MessageDetailedOpts
in its signature, which is an entirely new ADT featuring extremely granular options for the core users.AllowedMentions
which is used in the above Opts as a structure to control what the message is allowed to mention (e.g. disabling @ everyone pings)Remaining Issues: