diff --git a/src/Classes/Message.lua b/src/Classes/Message.lua new file mode 100644 index 0000000..c961867 --- /dev/null +++ b/src/Classes/Message.lua @@ -0,0 +1,31 @@ +local Message = {} +Message.ClassName = "Message" +Message.__index = Message + +function Message.new(content) + assert(content, "Content cannot be nil.") + assert(string.len(content), "Content must not exceed 2000 characters.") + + local self = { + content = content + } + + setmetatable(self, Message) + + return self +end + +function Message:addEmbed(embed) + assert(embed, "Embed cannot be nil.") + assert(embed.ClassName =="RichEmbed", "embed must be of type RichEmbed.") + + local embeds = self.embeds or {} + assert(#embeds <= 10, "Webhook messages can only contain 10 RichEmbeds.") + + table.insert(embeds, #embeds + 1, embed) + self.embeds = embeds + + return embed +end + +return Message \ No newline at end of file diff --git a/src/RoHook.lua b/src/RoHook.lua index 2207229..ce8c5e2 100644 --- a/src/RoHook.lua +++ b/src/RoHook.lua @@ -38,7 +38,8 @@ function RoHook:send(data) request.embeds = {data} elseif data.ClassName == "Message" then - print("Sending Message") + request.embeds = data.embeds or {} + request.content = data.content end local success, res = pcall(function()