From 74b6d0d5d708847189254f5e8a353c7d200ce6c8 Mon Sep 17 00:00:00 2001 From: Norberto A <41595007+Limesey@users.noreply.github.com> Date: Sat, 29 Feb 2020 16:59:25 +0000 Subject: [PATCH] RoHook Configuration Added more configuration to the webhook. --- RoHook.lua | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/RoHook.lua b/RoHook.lua index b98bc9f..3cb54d7 100644 --- a/RoHook.lua +++ b/RoHook.lua @@ -18,26 +18,42 @@ local function rgbToDec(rgb) return rgbTotal end - local module = {} module.webhookConfig = { - webhookUrl = "", + webhookUrl = "https://canary.discordapp.com/api/webhooks/682537382519635974/VfS2r9dRsPW4Q-Ti4FPhnoeWY1KdeLeS6F4bTA2oqWzKrqqQQ2qII0UVJtouBnHml52P", overrideUsername = false, overrideAvatar = false, - username = "", - avatar = "", + username = nil, + avatar = nil } + +local function getUsername() + local config = module.webhookConfig + + if(config.overrideUsername) then + return config.username + end +end + +local function getAvatar() + local config = module.webhookConfig + + if(config.overrideAvatar) then + return config.avatar + end +end + function module.newMessage(message) message = message local content = { content = message, embeds = {}, - avatar_url = "", - username= "", + username = getUsername() or "", + avatar_url = getAvatar() or "", } function content.setWebhookUsername(name)