79 lines
2.7 KiB
Go
79 lines
2.7 KiB
Go
package bolt
|
|
|
|
import "fmt"
|
|
|
|
//built-in Discord reactions
|
|
type Reaction string
|
|
|
|
const (
|
|
ReactionThumbsUp Reaction = ":+1:"
|
|
ReactionThumbsDown Reaction = ":-1:"
|
|
ReactionHundred Reaction = ":100:"
|
|
ReactionHeart Reaction = ":heart:"
|
|
ReactionPinkHeart Reaction = ":pink_heart:"
|
|
ReactionOrangeHeart Reaction = ":orange_heart:"
|
|
ReactionYellowHeart Reaction = ":yellow_heart:"
|
|
ReactionGreenHeart Reaction = ":green_heart:"
|
|
ReactionBlueHeart Reaction = ":blue_heart:"
|
|
ReactionBlackHeart Reaction = ":black_heart:"
|
|
ReactionPointUp Reaction = ":point_up:"
|
|
ReactionPointDown Reaction = ":point_down:"
|
|
ReactionHotdog Reaction = ":hotdog:"
|
|
ReactionDog Reaction = ":dog:"
|
|
ReactionCat Reaction = ":cat:"
|
|
ReactionMonkey Reaction = ":monkey:"
|
|
ReactionGiraffe Reaction = ":giraffe:"
|
|
ReactionDuck Reaction = ":duck:"
|
|
ReactionGoose Reaction = ":goose:"
|
|
ReactionWatermelon Reaction = ":watermelon:"
|
|
ReactionHoney Reaction = ":honey_pot:"
|
|
ReactionSandwich Reaction = ":sandwich:"
|
|
ReactionPepper Reaction = ":hot_pepper:"
|
|
ReactionNoPedestrians Reaction = ":no_pedestrian:"
|
|
ReactionExclamation Reaction = ":exclamation:"
|
|
ReactionDoubleExclamation Reaction = ":bangbang:"
|
|
ReactionSkull Reaction = ":skull:"
|
|
ReactionSpeakingHead Reaction = ":speaking_head:"
|
|
ReactionGreenCheck Reaction = ":white_check_mark:"
|
|
)
|
|
|
|
// 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
|
|
}
|