Image attach
This commit is contained in:
@@ -96,13 +96,57 @@ public struct GatewayHello: Codable, Sendable {
|
||||
}
|
||||
|
||||
public struct CreateMessageReq: Codable, Sendable {
|
||||
public init(content: String? = nil, message_reference: MessageRefrence? = nil) {
|
||||
public init(content: String? = nil, message_reference: MessageRefrence? = nil, embeds: [Embed]? = nil, files: [RawFile]? = nil, attachments: [Attachment]? = nil) {
|
||||
self.content = content
|
||||
self.message_reference = message_reference
|
||||
self.embeds = embeds
|
||||
self.files = files
|
||||
self.attachments = attachments
|
||||
}
|
||||
|
||||
public let content: String?
|
||||
public let message_reference: MessageRefrence?
|
||||
public let embeds: [Embed]?
|
||||
public let files: [RawFile]?
|
||||
public let attachments: [Attachment]?
|
||||
}
|
||||
|
||||
public struct Attachment: Codable, Sendable {
|
||||
public init(index: Int, filename: String? = nil) {
|
||||
self.index = index
|
||||
self.filename = filename
|
||||
}
|
||||
|
||||
public let index: Int
|
||||
public let filename: String?
|
||||
}
|
||||
|
||||
public struct RawFile: Codable, Sendable {
|
||||
public init(data: Data, filename: String? = nil) {
|
||||
self.data = data
|
||||
self.filename = filename
|
||||
}
|
||||
|
||||
public let data: Data
|
||||
public let filename: String?
|
||||
}
|
||||
|
||||
public struct Embed: Codable, Sendable {
|
||||
public init(description: String? = nil, image: EmbedImage? = nil) {
|
||||
self.description = description
|
||||
self.image = image
|
||||
}
|
||||
|
||||
public let description: String?
|
||||
public let image: EmbedImage?
|
||||
}
|
||||
|
||||
public struct EmbedImage: Codable, Sendable {
|
||||
public init(url: String) {
|
||||
self.url = url
|
||||
}
|
||||
|
||||
public let url: String
|
||||
}
|
||||
|
||||
public struct MessageRefrence: Codable, Sendable {
|
||||
@@ -125,12 +169,28 @@ public struct MessageCreate: Codable, Sendable {
|
||||
public let guild_id: String?
|
||||
public let author: User?
|
||||
public let content: String
|
||||
public let mentions: [User]
|
||||
public let mentions: [MentionUser]
|
||||
public let member: GuildMember?
|
||||
}
|
||||
|
||||
|
||||
public struct User: Codable, Sendable {
|
||||
public let id: String?
|
||||
public let bot: Bool?
|
||||
public let global_name: String?
|
||||
public let username: String
|
||||
}
|
||||
|
||||
public struct GuildMember: Codable, Sendable {
|
||||
public let user: User?
|
||||
public let nick: String?
|
||||
}
|
||||
|
||||
public struct MentionUser: Codable, Sendable {
|
||||
public let id: String?
|
||||
public let bot: Bool?
|
||||
public let global_name: String?
|
||||
public let username: String
|
||||
public let member: GuildMember?
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user