diff --git a/data/cdata/ui_scripts/discord/__init__.lua b/data/cdata/ui_scripts/discord/__init__.lua index fe988a68..05d8e25a 100644 --- a/data/cdata/ui_scripts/discord/__init__.lua +++ b/data/cdata/ui_scripts/discord/__init__.lua @@ -18,9 +18,6 @@ function canasktojoin(userid) end history[userid] = true - game:ontimeout(function() - history[userid] = nil - end, 15000) return true end @@ -206,6 +203,7 @@ function addrequest(request) invite:registerEventHandler("end_invite", function() close() discord.respond(request.userid, discord.reply.ignore) + history[request.userid] = nil end) local bar = LUI.UIImage.new({ diff --git a/src/client/component/discord.cpp b/src/client/component/discord.cpp index ec8ab143..d129974d 100644 --- a/src/client/component/discord.cpp +++ b/src/client/component/discord.cpp @@ -143,8 +143,6 @@ namespace discord void update_discord() { - Discord_RunCallbacks(); - // reset presence data const auto saved_time = discord_presence.startTimestamp; discord_presence = {}; @@ -314,7 +312,13 @@ namespace discord Discord_Initialize("947125042930667530", &handlers, 1, nullptr); scheduler::once(download_default_avatar, scheduler::pipeline::async); - scheduler::loop(update_discord, scheduler::pipeline::async, 5s); + + scheduler::once([]() + { + scheduler::once(update_discord, scheduler::pipeline::async); + scheduler::loop(update_discord, scheduler::pipeline::async, 5s); + scheduler::loop(Discord_RunCallbacks, scheduler::pipeline::async, 1s); + }, scheduler::pipeline::main); initialized_ = true; } diff --git a/src/client/component/input.cpp b/src/client/component/input.cpp index ad14ae43..5112620e 100644 --- a/src/client/component/input.cpp +++ b/src/client/component/input.cpp @@ -36,7 +36,7 @@ namespace input void cl_key_event_stub(const int local_client_num, const int key, const int down) { - if (game::environment::is_sp() && ui_scripting::lui_running()) + if (ui_scripting::lui_running()) { ui_scripting::notify(down ? "keydown" : "keyup", {