2025-07-09 20:11:12 +00:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
//built-in Discord reactions
|
|
|
|
type Reaction string
|
|
|
|
|
2025-07-16 13:35:39 -04:00
|
|
|
//a few easy-to-use emojis, Discordgo/Discord API requires them to be saved like this.
|
2025-07-09 20:11:12 +00:00
|
|
|
const (
|
2025-07-16 13:35:39 -04:00
|
|
|
ReactionThumbsUp Reaction = "👍"
|
|
|
|
ReactionThumbsDown Reaction = "👎"
|
|
|
|
ReactionHundred Reaction = "💯"
|
|
|
|
ReactionHeart Reaction = "❤️"
|
|
|
|
ReactionPinkHeart Reaction = "🩷"
|
|
|
|
ReactionOrangeHeart Reaction = "🧡"
|
|
|
|
ReactionYellowHeart Reaction = "💛"
|
|
|
|
ReactionGreenHeart Reaction = "💚"
|
|
|
|
ReactionBlueHeart Reaction = "💙"
|
|
|
|
ReactionBlackHeart Reaction = "🖤"
|
|
|
|
ReactionPointUp Reaction = "☝️"
|
|
|
|
ReactionPointDown Reaction = "👇"
|
|
|
|
ReactionHotdog Reaction = "🌭"
|
|
|
|
ReactionDog Reaction = "🐶"
|
|
|
|
ReactionCat Reaction = "🐱"
|
|
|
|
ReactionMonkey Reaction = "🐒"
|
|
|
|
ReactionGiraffe Reaction = "🦒"
|
|
|
|
ReactionDuck Reaction = "🦆"
|
|
|
|
ReactionGoose Reaction = "🪿"
|
|
|
|
ReactionWatermelon Reaction = "🍉"
|
|
|
|
ReactionHoney Reaction = "🍯"
|
|
|
|
ReactionSandwich Reaction = "🥪"
|
|
|
|
ReactionPepper Reaction = "🌶️"
|
|
|
|
ReactionNoPedestrians Reaction = "🚷"
|
|
|
|
ReactionExclamation Reaction = "❗"
|
|
|
|
ReactionDoubleExclamation Reaction = "‼️"
|
|
|
|
ReactionSkull Reaction = "💀"
|
|
|
|
ReactionSpeakingHead Reaction = "🗣️"
|
|
|
|
ReactionGreenCheck Reaction = "✅"
|
2025-07-16 15:53:22 -04:00
|
|
|
ReactionDragon Reaction = "🐉"
|
2025-07-09 20:11:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// information about attachments to messages
|
|
|
|
type MessageAttachment struct {
|
|
|
|
ID string
|
|
|
|
URL string
|
|
|
|
ProxyURL string
|
|
|
|
Filename string
|
|
|
|
ContentType string
|
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
Size int
|
|
|
|
DurationSecs float64
|
|
|
|
}
|
|
|
|
|
|
|
|
// represents a Discord message
|
|
|
|
type Message struct {
|
|
|
|
Author string //username of message author
|
|
|
|
ID string //discord ID of message author
|
|
|
|
msgID string //id string of message
|
|
|
|
Words []string //words from message split on whitespace
|
|
|
|
Content string //entire message content
|
|
|
|
Channel string //message channel
|
|
|
|
channelID string //id of channel message was sent in
|
|
|
|
Server string //message guild
|
|
|
|
serverID string //id of guild message was sent in
|
|
|
|
Attachments []MessageAttachment
|
|
|
|
sesh *bolt
|
|
|
|
}
|
|
|
|
|
|
|
|
// applies reaction to message
|
|
|
|
func (m *Message) React(emoji Reaction) error {
|
|
|
|
return m.sesh.MessageReactionAdd(m.channelID, m.msgID, fmt.Sprint(emoji))
|
|
|
|
}
|
|
|
|
|
|
|
|
// sends the value of res in response to the message
|
|
|
|
func (m *Message) Respond(res string) error {
|
|
|
|
rep := m.sesh.createReply(res, m.msgID, m.channelID, m.serverID)
|
|
|
|
_, err := m.sesh.ChannelMessageSendComplex(m.channelID, rep)
|
|
|
|
return err
|
|
|
|
}
|