From 29ae35df62a9acf2883e0e5c8e0b7924b278f211 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 25 Aug 2022 09:20:36 -0500 Subject: [PATCH 1/5] Fixed RateLimitHandler using milliseconds instead of seconds. --- Oxide.Ext.Discord/Rest/RateLimitHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Oxide.Ext.Discord/Rest/RateLimitHandler.cs b/Oxide.Ext.Discord/Rest/RateLimitHandler.cs index f9173de40..614d1299b 100644 --- a/Oxide.Ext.Discord/Rest/RateLimitHandler.cs +++ b/Oxide.Ext.Discord/Rest/RateLimitHandler.cs @@ -29,7 +29,7 @@ public class RateLimitHandler /// public RateLimitHandler() { - _timer = new Timer(ResetInterval); + _timer = new Timer(ResetInterval * 1000); _timer.Elapsed += ResetGlobal; _timer.Start(); _lastReset = Time.TimeSinceEpoch(); From 78bf387becf50be0ab58fccb1db1c42a510b36aa Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 25 Aug 2022 09:22:27 -0500 Subject: [PATCH 2/5] Fixed OnDiscordGuildMemberRemoved passing wrong member parameter. --- Oxide.Ext.Discord/WebSockets/SocketListener.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Oxide.Ext.Discord/WebSockets/SocketListener.cs b/Oxide.Ext.Discord/WebSockets/SocketListener.cs index 54ac8ff7c..685f9d44c 100644 --- a/Oxide.Ext.Discord/WebSockets/SocketListener.cs +++ b/Oxide.Ext.Discord/WebSockets/SocketListener.cs @@ -895,6 +895,7 @@ private void HandleDispatchGuildMemberRemove(EventPayload payload) if (member != null) { guild.Members.Remove(remove.User.Id); + _client.CallHook(DiscordExtHooks.OnDiscordGuildMemberRemoved, member, guild); } _logger.Verbose($"{nameof(SocketListener)}.{nameof(HandleDispatchGuildMemberRemove)} Guild ID: {remove.GuildId.ToString()} Guild Name: {guild.Name} User ID: {member?.User.Id.ToString()} User Name: {member?.User.GetFullUserName}"); From 2db4fdc21e4c41257447a6271655186ec2ea0472 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 25 Aug 2022 09:27:46 -0500 Subject: [PATCH 3/5] Fix Retry after using int when it's a float causing errors during rate limiting --- Oxide.Ext.Discord/Entities/Api/RateLimit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Oxide.Ext.Discord/Entities/Api/RateLimit.cs b/Oxide.Ext.Discord/Entities/Api/RateLimit.cs index 80d3db285..96b19f968 100644 --- a/Oxide.Ext.Discord/Entities/Api/RateLimit.cs +++ b/Oxide.Ext.Discord/Entities/Api/RateLimit.cs @@ -18,7 +18,7 @@ public class RateLimit /// The number of seconds to wait before submitting another request. /// [JsonProperty("retry_after")] - public int RetryAfter { get; set; } + public float RetryAfter { get; set; } /// /// A value indicating if you are being globally rate limited or not From fecb2454b124d01d4bce28b6b00a880fd06e2ec3 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 25 Aug 2022 09:28:31 -0500 Subject: [PATCH 4/5] Version Bump --- Oxide.Ext.Discord/DiscordExtension.cs | 2 +- Oxide.Ext.Discord/Oxide.Ext.Discord.csproj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Oxide.Ext.Discord/DiscordExtension.cs b/Oxide.Ext.Discord/DiscordExtension.cs index 223e862c4..15bebe0ad 100644 --- a/Oxide.Ext.Discord/DiscordExtension.cs +++ b/Oxide.Ext.Discord/DiscordExtension.cs @@ -34,7 +34,7 @@ public class DiscordExtension : Extension /// /// Version number of the extension /// - private static readonly VersionNumber ExtensionVersion = new VersionNumber(2, 1, 5); + private static readonly VersionNumber ExtensionVersion = new VersionNumber(2, 1, 6); /// /// Global logger for areas that aren't part of a client connection diff --git a/Oxide.Ext.Discord/Oxide.Ext.Discord.csproj b/Oxide.Ext.Discord/Oxide.Ext.Discord.csproj index b37ab2ad8..f06d25143 100644 --- a/Oxide.Ext.Discord/Oxide.Ext.Discord.csproj +++ b/Oxide.Ext.Discord/Oxide.Ext.Discord.csproj @@ -2,16 +2,16 @@ - 2.0.3.0 + 2.1.6.0 Oxide.Ext.Discord Kirollos An Oxide extension for Discord. https://github.com/Kirollos/Oxide.Ext.Discord net46;net48 7.0 - 2.1.5.0 - 2.1.5 - 2.1.5 + 2.1.6.0 + 2.1.6 + 2.1.6 From 484b0f618d3027648818a492fc9706589726197a Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 25 Aug 2022 09:30:36 -0500 Subject: [PATCH 5/5] Update Discord Token Validator again... --- Oxide.Ext.Discord/DiscordClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Oxide.Ext.Discord/DiscordClient.cs b/Oxide.Ext.Discord/DiscordClient.cs index 7e87d0cd3..5302f6bf6 100644 --- a/Oxide.Ext.Discord/DiscordClient.cs +++ b/Oxide.Ext.Discord/DiscordClient.cs @@ -19,7 +19,7 @@ public class DiscordClient { internal static readonly Hash Clients = new Hash(); - private static readonly Regex TokenValidator = new Regex(@"^[\w-]{24}\.[\w-]{6}\.[\w-]+$", RegexOptions.Compiled); + private static readonly Regex TokenValidator = new Regex(@"^[\w-]+\.[\w-]+\.[\w-]+$", RegexOptions.Compiled); /// /// Which plugin is the owner of this client