Message
public struct Message
Message Type
-
Array of Attachment structs that was sent with the message
Declaration
Swift
public internal(set) var attachments = [Attachment]() -
User struct of the author (not returned if webhook)
Declaration
Swift
public let author: User? -
Content of the message
Declaration
Swift
public let content: String -
Channel struct of the message
Declaration
Swift
public let channel: TextChannel -
If message was edited, this is the time it happened
Declaration
Swift
public let editedTimestamp: Date? -
Array of embeds sent with message
Declaration
Swift
public internal(set) var embeds = [Embed]() -
Message ID
Declaration
Swift
public let id: Snowflake -
Whether or not this message mentioned everyone
Declaration
Swift
public let isEveryoneMentioned: Bool -
Whether or not this message is pinned in it’s channel
Declaration
Swift
public let isPinned: Bool -
Whether or not this messaged was ttsed
Declaration
Swift
public let isTts: Bool -
Member struct for message
Declaration
Swift
public internal(set) var member: Member? -
Array of Users that were mentioned
Declaration
Swift
public internal(set) var mentions = [User]() -
Array of Roles that were mentioned
Declaration
Swift
public internal(set) var mentionedRoles = [Snowflake]() -
Used to validate a message was sent
Declaration
Swift
public let nonce: Snowflake? -
Array of reactions with message
Declaration
Swift
public internal(set) var reactions = [[String: Any]]() -
Time when message was sent
Declaration
Swift
public let timestamp: Date -
Determines what type of message was sent
Declaration
Swift
public let type: Type -
If message was sent by webhook, this is that webhook’s ID
Declaration
Swift
public let webhookId: Snowflake?
-
Adds a reaction to self
Declaration
Swift
public func add( reaction: String, then completion: ((RequestError?) -> ())? = nil ) -
Deletes self
Declaration
Swift
public func delete(then completion: ((RequestError?) -> ())? = nil) -
Deletes reaction from self
Declaration
Swift
public func delete( reaction: String, from userId: Snowflake? = nil, then completion: ((RequestError?) -> ())? = nil ) -
Deletes all reactions from self
Declaration
Swift
public func deleteReactions(then completion: ((RequestError?) -> ())? = nil) -
Edit self’s content
Declaration
Swift
public func edit( with options: [String: Any], then completion: ((Message?, RequestError?) -> ())? = nil ) -
Get array of users from reaction
Declaration
Swift
public func get( reaction: String, then completion: @escaping ([User]?, RequestError?) -> () ) -
Pins self
Declaration
Swift
public func pin(then completion: ((RequestError?) -> ())? = nil) -
Replies to a channel
Declaration
Swift
public func reply( with message: String, then completion: ((Message?, RequestError?) -> ())? = nil ) -
Replies to a channel
Message Options
Refer to Discord’s documentation on the message body https://discord.com/developers/docs/resources/channel#create-message-json-params
Declaration
Swift
public func reply( with message: [String: Any], then completion: ((Message?, RequestError?) -> ())? = nil ) -
Replies to a channel with an Embed
Declaration
Swift
public func reply( with message: Embed, then completion: ((Message?, RequestError?) -> ())? = nil )
View on GitHub
Message Struct Reference