NullReferenceException with DiscordObjects.Channel.GetChannel

(19:40:38) | Failed to call hook 'OnPlayerChat' on plugin 'Rustcord v1.1.1' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Ext.Discord.DiscordObjects.Channel.GetChannel (Oxide.Ext.Discord.DiscordClient client, System.String channelID, System.Action`1[T] callback) [0x00001] in :0 at Oxide.Plugins.Rustcord+c__AnonStorey0.<>m__0 (Oxide.Plugins.Rustcord+Settings+Channel ch) [0x00011] in :0 at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in :0 at Oxide.Plugins.Rustcord.OnPlayerChat (ConsoleSystem+Arg arg) [0x0015e] in :0 at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x001cd] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

 

Everytime someone types in chat on the server, this shows.

Same here.
[Oxide] 21:28 [Error] Failed to call hook 'OnPlayerChat' on plugin 'Rustcord v1.1.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Ext.Discord.DiscordObjects.Channel.GetChannel (Oxide.Ext.Discord.DiscordClient client, System.String channelID, System.Action`1[T] callback) [0x00001] in <a0ca46ad95cf495bb369175775e0a8cd>:0 
  at Oxide.Plugins.Rustcord+<OnPlayerChat>c__AnonStorey0.<>m__0 (Oxide.Plugins.Rustcord+Settings+Channel ch) [0x00011] in <11f213a1b6f84314a1cf0ce8975ec46c>:0 
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Oxide.Plugins.Rustcord.OnPlayerChat (ConsoleSystem+Arg arg) [0x0015e] in <11f213a1b6f84314a1cf0ce8975ec46c>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00532] in <11f213a1b6f84314a1cf0ce8975ec46c>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

(21:29:19) | [Oxide] 21:29 [Info] Unloaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
(21:29:19) | [Oxide] 21:29 [Error] Failed to initialize plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNextRare () [0x00013] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1+Enumerator[T].MoveNext () [0x0004a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Oxide.Plugins.Rustcord.Loaded () [0x000bb] in <11f213a1b6f84314a1cf0ce8975ec46c>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x005f4] in <11f213a1b6f84314a1cf0ce8975ec46c>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Plugins.CSharpPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x0006e] in <9affce1cd15c4ec183941adef8db1722>:0
(21:29:19) | [Oxide] 21:29 [Info] Unloaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
(21:29:19) | [Oxide] 21:29 [Info] Previous version of plugin failed to load: Rustcord
(21:29:25) | [Oxide] 21:29 [Info] Loaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
​
Hi, please make sure the channel configuration in the config file is correct + Channel ID is valid.
It is, the most of the time it works dont know what cause this issue
reload plugin, if errors, manually unload then manually load
I get the same error, even after manually unloading and loading the plugin.

It seems like it's able to get every other message, but most of the messages fail with this error:


(08:51:08) | Failed to call hook 'OnPlayerChat' on plugin 'Rustcord v1.1.1' (InvalidOperationException: Collection was modified; enumeration operation may not execute.)
  at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) [0x0000b] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00053] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Oxide.Ext.Discord.REST.RESTHandler.BucketRequest (Oxide.Ext.Discord.REST.Request request, System.Action`1[T] callback) [0x0000e] in <c70faa7e50854fe0b707ce4ec3a240ad>:0 
  at Oxide.Ext.Discord.REST.RESTHandler.CreateRequest (Oxide.Ext.Discord.REST.RequestMethod method, System.String url, System.Collections.Generic.Dictionary`2[TKey,TValue] headers, System.Object data, System.Action`1[T] callback) [0x0007b] in <c70faa7e50854fe0b707ce4ec3a240ad>:0 
  at Oxide.Ext.Discord.REST.RESTHandler.DoRequest[T] (System.String url, Oxide.Ext.Discord.REST.RequestMethod method, System.Object data, System.Action`1[T] callback) [0x0000f] in <c70faa7e50854fe0b707ce4ec3a240ad>:0 
  at Oxide.Ext.Discord.DiscordObjects.Channel.GetChannel (Oxide.Ext.Discord.DiscordClient client, System.String channelID, System.Action`1[T] callback) [0x0001f] in <c70faa7e50854fe0b707ce4ec3a240ad>:0 
  at Oxide.Plugins.Rustcord.OnPlayerChat (ConsoleSystem+Arg arg) [0x0003c] in <c72b13c6455b4b338407bb2096617afd>:0 
  at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0008d] in <c72b13c6455b4b338407bb2096617afd>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0​

I am using the correct channel id, because it works sometimes:



I also see this error message when loading the plugin:

(08:54:09) | Unloaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
(08:54:14) | Loaded plugin Rustcord v1.1.1 by Kirollos & OuTSMoKE
(08:54:15) | Failed to run a 1.00 timer in 'Rustcord v1.1.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.Rustcord.<Discord_Ready>m__1 () [0x00000] in <c72b13c6455b4b338407bb2096617afd>:0 
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <4452f821def6406d834e4149849fe7ea>:0​
I am geting this error as well | Failed to call hook 'OnPlayerInit' on plugin 'Rustcord v1.1.1' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Ext.Discord.DiscordObjects.Channel.GetChannel (Oxide.Ext.Discord.DiscordClient client, System.String channelID, System.Action`1[T] callback) [0x00001] in :0 at Oxide.Plugins.Rustcord+c__AnonStorey1.<>m__1 (Oxide.Plugins.Rustcord+Settings+Channel ch) [0x00011] in <711d2bf540f34110b5e6c6d957d6d31f>:0 at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in :0 at Oxide.Plugins.Rustcord.OnPlayerInit (BasePlayer player) [0x00089] in <711d2bf540f34110b5e6c6d957d6d31f>:0 at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x001f8] in <711d2bf540f34110b5e6c6d957d6d31f>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0
Hi, I'll have a look at that and let you know.