From 876e1ef040e4a6e465f083a3a12e3bc9478e98d3 Mon Sep 17 00:00:00 2001 From: Norberto A <41595007+Limesey@users.noreply.github.com> Date: Sun, 24 May 2020 17:02:19 +0100 Subject: [PATCH] Update RoHook.lua --- RoHook.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/RoHook.lua b/RoHook.lua index 259b87c..4a55d43 100644 --- a/RoHook.lua +++ b/RoHook.lua @@ -80,6 +80,16 @@ function module.newMessage(message) end function content.addEmbed(title, description) + if(title and string.len(title) > 256) then + warn("Title cannot be longer than 265 characters.") + title = string.sub(title, 1, 256) + end + + if(description and string.len(description > 2048)) then + warn("Description cannot be longer than 2048 characters.") + description = string.sub(description, 1, 2048) + end + local embed = { title = title, description = description, @@ -103,16 +113,6 @@ function module.newMessage(message) timestamp = "" --"YYYY-MM-DDTHH:MM:SS.MSSZ" } - if(title and string.len(title) > 256) then - warn("Title cannot be longer than 265 characters.") - title = string.sub(title, 1, 256) - end - - if(description and string.len(description > 2048)) then - warn("Description cannot be longer than 2048 characters.") - description = string.sub(description, 1, 2048) - end - table.insert(content.embeds, embed) function embed.setColor(rgb)