diff --git a/lua/gmod_integration/client/cl_report_bug.lua b/lua/gmod_integration/client/cl_report_bug.lua index 8412e55..a0ef5df 100644 --- a/lua/gmod_integration/client/cl_report_bug.lua +++ b/lua/gmod_integration/client/cl_report_bug.lua @@ -203,10 +203,17 @@ local function openReportBug() ["steps"] = elements[3]:GetText(), ["expected"] = elements[4]:GetText(), ["actual"] = elements[5]:GetText(), - }, function() + }, function(code, body) notification.AddLegacy(gmInte.getTranslation("report_bug.success", "Bug report sent successfully"), NOTIFY_GENERIC, 5) frame:Close() - end, function() notification.AddLegacy(gmInte.getTranslation("report_bug.error.failed", "Failed to send bug report retry later"), NOTIFY_ERROR, 5) end) + end, function(code, body) + if code == 429 then + gmInte.chatAddText(Color(255, 255, 255), gmInte.getTranslation("chat.error.rate_limit", "This interaction is being rate limited, please try again later.")) + return + end + + notification.AddLegacy(gmInte.getTranslation("report_bug.error.failed", "Failed to send bug report retry later"), NOTIFY_ERROR, 5) + end) end end diff --git a/lua/gmod_integration/client/cl_screenshots.lua b/lua/gmod_integration/client/cl_screenshots.lua index 44bb32c..ca6db24 100644 --- a/lua/gmod_integration/client/cl_screenshots.lua +++ b/lua/gmod_integration/client/cl_screenshots.lua @@ -37,7 +37,14 @@ hook.Add("PostRender", "gmInteScreenshot", function() ["screenshot"] = base64Capture, ["captureData"] = captureData, ["size"] = size .. "KB" - }, function(code, body) gmInte.chatAddText(Color(255, 130, 92), gmInte.getTranslation("chat.screenshot.sent", "Screenshot sent to Discord.")) end, function(code, body) gmInte.log("Screenshot failed to send to Discord, error code: " .. code, true) end) + }, function(code, body) gmInte.chatAddText(Color(255, 130, 92), gmInte.getTranslation("chat.screenshot.sent", "Screenshot sent to Discord.")) end, function(code, body) + if code == 429 then + gmInte.chatAddText(Color(255, 255, 255), gmInte.getTranslation("chat.error.rate_limit", "This interaction is being rate limited, please try again later.")) + return + end + + gmInte.log("Screenshot failed to send to Discord, error code: " .. code, true) + end) end) function gmInte.takeScreenShot() diff --git a/lua/gmod_integration/shared/languages/sh_en.lua b/lua/gmod_integration/shared/languages/sh_en.lua index 5632db1..4af6955 100644 --- a/lua/gmod_integration/shared/languages/sh_en.lua +++ b/lua/gmod_integration/shared/languages/sh_en.lua @@ -1,4 +1,5 @@ return { + ["chat.error.rate_limit"] = "This interaction is being rate limited, please try again later.", ["verification.title"] = "Verification Required", ["verification.open_page"] = "Open Verification Page", ["verification.description"] = "Hey,\nIt looks like you haven't linked your Steam account to Discord yet. This is required to play on this server. Please click the button below to link your account.\n\nAfter you've done that, click the refresh button.",