Documentation
¶
Index ¶
- Variables
- func BuildTimestamp(timestamp time.Time, style TimestampStyle) string
- func BuildTimestampFromUnixSecs(timestamp int64, style TimestampStyle) string
- func SumFlags(flags ...MessageFlag) (sum uint)
- type AllowedMention
- type AllowedMentionType
- type ChannelMention
- type Message
- type MessageActivity
- type MessageActivityType
- type MessageApplication
- type MessageFlag
- type MessageMentionedUser
- type MessageReference
- type MessageType
- type Reaction
- type TimestampStyle
Constants ¶
This section is empty.
Variables ¶
View Source
var MentionEveryone = AllowedMention{ Parse: []AllowedMentionType{EVERYONE}, }
Helper
Functions ¶
func BuildTimestamp ¶
func BuildTimestamp(timestamp time.Time, style TimestampStyle) string
func BuildTimestampFromUnixSecs ¶
func BuildTimestampFromUnixSecs(timestamp int64, style TimestampStyle) string
func SumFlags ¶
func SumFlags(flags ...MessageFlag) (sum uint)
Types ¶
type AllowedMention ¶
type AllowedMention struct {
Parse []AllowedMentionType `json:"parse,omitempty"`
Roles utils.Uint64StringSlice `json:"roles,omitempty"`
Users utils.Uint64StringSlice `json:"users,omitempty"`
RepliedUser bool `json:"replied_user"`
}
type AllowedMentionType ¶
type AllowedMentionType string
const ( EVERYONE AllowedMentionType = "everyone" USERS AllowedMentionType = "users" ROLES AllowedMentionType = "roles" )
type ChannelMention ¶
type ChannelMention struct {
Id uint64 `json:"id,string"`
GuildId uint64 `json:"guild_id,string"`
Type channel.ChannelType `json:"type"`
Name string `json:"name"` // channel name
}
type Message ¶
type Message struct {
Id uint64 `json:"id,string"`
ChannelId uint64 `json:"channel_id,string"`
GuildId uint64 `json:"guild_id,string"`
Author user.User `json:"author"`
Member member.Member `json:"member"`
Content string `json:"content"`
Timestamp time.Time `json:"timestamp"`
EditedTimestamp *time.Time `json:"edited_timestamp,omitempty"`
Tts bool `json:"tts"`
MentionEveryone bool `json:"mention_everyone"`
Mentions []MessageMentionedUser `json:"mentions,omitempty"` // The user objects in the mentions array will only have the partial member field present in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels
MentionRoles utils.Uint64StringSlice `json:"mention_roles"`
VisibleMentionedChannels []ChannelMention `json:"mention_channels,omitempty"` // Not all channel mentions in a message will appear in mention_channels. Only textual channels that are visible to everyone in a lurkable guild will ever be included. Only crossposted messages (via Channel Following) currently include mention_channels at all. If no mentions in the message meet these requirements, this field will not be sent.
Attachments []channel.Attachment `json:"attachments,omitempty"`
Embeds []embed.Embed `json:"embeds,omitempty"`
Reactions []Reaction `json:"reactions,omitempty"`
Nonce interface{} `json:"nonce,omitempty"`
Pinned bool `json:"pinned"`
WebhookId uint64 `json:"webhook_id,string"` // if the message is generated by a webhook, this is the webhook's id
Type MessageType `json:"message_type"`
Activity MessageActivity `json:"activity"`
Application MessageApplication `json:"application"`
MessageReference MessageReference `json:"message_reference"` // reference data sent with crossposted messages
Flags int `json:"flags"`
ReferencedMessage *MessageReference `json:"referenced_message,omitempty"`
Components []component.Component `json:"components,omitempty"`
}
func (*Message) ChannelMentions ¶
type MessageActivity ¶
type MessageActivity struct {
Type MessageActivityType `json:"type"`
PartyId string `json:"party_id"`
}
type MessageActivityType ¶
type MessageActivityType int
const ( MessageActivityJoin MessageActivityType = iota MessageActivitySpectate MessageActivityListen MessageActivityJoinRequest )
type MessageApplication ¶
type MessageFlag ¶
type MessageFlag uint
const ( FlagCrossposted MessageFlag = 1 << iota FlagIsCrosspost FlagSupressEmbeds FlagSourceMessageDeleted FlagUrgent FlagEphemeral FlagLoading )
type MessageMentionedUser ¶
Mentions is an array of users with partial member
type MessageReference ¶
type MessageType ¶
type MessageType int
const ( MessageTypeDefault MessageType = iota MessageTypeRecipientAdd MessageTypeRecipientRemove MessageTypeCall MessageTypeChannelNameChange MessageTypeChannelIconChange MessageTypeChannelPinnedMessage MessageTypeGuildMemberJoin MessageTypeUserPremiumGuildSubscription MessageTypeUserPremiumGuildSubscriptionTier1 MessageTypeUserPremiumGuildSubscriptionTier2 MessageTypeUserPremiumGuildSubscriptionTier3 MessageTypeChannelFollowAdd MessageTypeGuildDiscoveryDisqualified MessageTypeGuildDiscoveryRequalified MessageTypeGuildDiscoveryGracePeriodInitialWarning MessageTypeGuildDiscoveryGracePeriodFinalWarning MessageTypeThreadCreated MessageTypeReply MessageTypeApplicationCommand MessageTypeThreadStarterMessage MessageTypeGuildInviteReminder )
type TimestampStyle ¶
type TimestampStyle string
const ( TimestampStyleShortTime TimestampStyle = "s" TimestampStyleLongTime TimestampStyle = "T" TimestampStyleShortDate TimestampStyle = "d" TimestampStyleLongDate TimestampStyle = "D" TimestampStyleShortDateTime TimestampStyle = "f" TimestampStyleLongDateTime TimestampStyle = "F" TimestampStyleRelativeTime TimestampStyle = "R" )
Click to show internal directories.
Click to hide internal directories.