Eco-DiscordLink / EcoDiscordPlugin

A plugin that interfaces Eco Global Survival's server with Discord
GNU Affero General Public License v3.0
33 stars 15 forks source link

Sending Eco Command from Discord to Game Error #96

Closed Dave247 closed 10 months ago

Dave247 commented 10 months ago

I have tried sending both a modded command (/ann from Nid's) and a vanilla command (/civics ticknow) from Discord to the server, however both fail and result in a error message being thrown by the server itself.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Eco.EM.Framework.Permissions.ChatCommandAdapter.cDisplayClass14_0.b2(SimpleGroupUser sgu)
   at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
   at Eco.EM.Framework.Permissions.ChatCommandAdapter.cDisplayClass14_0.b0(Group grp)
   at System.Linq.Enumerable.WhereListIterator1.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func`2 predicate)
   at Eco.EM.Framework.Permissions.ChatCommandAdapter.Permit(SimpleGroupUser user)
   at Eco.EM.Framework.Groups.GroupsAPI.UserPermitted(SimpleGroupUser user, IGroupAuthorizable permission)
   at Eco.EM.Framework.Groups.GroupsAPI.UserPermitted(IChatClient chatClient, IGroupAuthorizable permission)
   at Eco.EM.Framework.Permissions.EMCustomChatProcessor.EMProcessCommand(ChatCommand command, IChatClient chatClient)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.CanRunCommand(IChatClient chatClient, ChatCommand command)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.TryInvokeCommand(IChatClient chatClient, String text, SupportedLanguage language, INetObject target, Task& invokeTask)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.HandleCommandAsync(IChatClient chatClient, String text, SupportedLanguage language, INetObject target)
MonzUn commented 10 months ago

I cannot reproduce this with or without EM framework (3.5.1) installed. Ticknow command and several others run as expected. I'm going to need more information on the repro.

Dave247 commented 10 months ago

I'm not sure if I'll ever be able to get to the bottom of this. When I tried to reproduce it myself on a local instance of the server I wasn't able to either. It may need to just be put aside, as I can't help doubting the stability of our servers environment where the state it has been in is likely not the best/indicative of a proper production environment, due to some of the other strange and unexplainable issues that we have faced.

MonzUn commented 10 months ago

Does it still happen on your server?

Dave247 commented 10 months ago

Does it still happen on your server?

Yeah it does. I can send you the word save if you like?

MonzUn commented 10 months ago

Wouldn't help much since the issue occurs in EM. Even if something is wrong on my end, I wouldn't see it.

The EM config files would also be needed of course.

Do you get the same issue if you run the same commands via the official remote command interface?

Dave247 commented 10 months ago

Huh, just as I was gearing up to test it, I tried it once more following th 10.0.4 update and it works now as it should. None of the mods have updated, so maybe it was some minor thing that changed with the server that broke it and has now been restored?

Seeing as I can't manage to reproduce it at all anymore I guess the ticket should just get closed and filed away, as there's nothing really else left for it now.

MonzUn commented 10 months ago

The recent update shouldn't have changed anything, especially since Kye overrides the command permission system. But OK, I'll close it and you can ropen if the issue persists, but in the end it's EM Framework that needs to be debugged first to find where the issue is :)

Dave247 commented 8 months ago

Ok so new cycle, I've tried again to send one of Nid's player command modules commands /ann from the game to DIscord and got an error, but it is a different one to last time that doesn't seem to be related to EM. First encountered on our live server, I have managed to successfully reproduce it on a local minimal reproduction state using only DL, EMF, Nids core and player module mods loaded. I am able to send vanilla commands such without issue.


[22:00:14.434] [256] [Error] [Eco] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Eco.EM.Framework.ChatBase.ChatBase.Message..ctor(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.EM.Framework.ChatBase.ChatBaseExtended.CBMessage(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.Nid.Helpers.Chat.SendPlayerConf(User user, String[] message)
   at Eco.Nid.PlayerManager.Commands.Chat.Ann(IChatClient chatClient, String text, Int32 size, Boolean showAsPopUp, Boolean showAsOKBox, Boolean addToMail, String windowHeader, String tag)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.InvokeWithManyArguments(RuntimeMethodInfo mi, Int32 argCount, Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.<>c__DisplayClass16_0.<InvokeCommand>b__1()
   at Eco.Core.Utils.Async.TaskUtils.<>c__DisplayClass3_0.<RunWithExceptionLog>b__0() System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Eco.EM.Framework.ChatBase.ChatBase.Message..ctor(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.EM.Framework.ChatBase.ChatBaseExtended.CBMessage(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.Nid.Helpers.Chat.SendPlayerConf(User user, String[] message)
   at Eco.Nid.PlayerManager.Commands.Chat.Ann(IChatClient chatClient, String text, Int32 size, Boolean showAsPopUp, Boolean showAsOKBox, Boolean addToMail, String windowHeader, String tag)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.InvokeWithManyArguments(RuntimeMethodInfo mi, Int32 argCount, Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.<>c__DisplayClass16_0.<InvokeCommand>b__1()
   at Eco.Core.Utils.Async.TaskUtils.<>c__DisplayClass3_0.<RunWithExceptionLog>b__0()
[22:00:14.434] [256] [Error] [Eco] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Eco.EM.Framework.ChatBase.ChatBase.Message..ctor(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.EM.Framework.ChatBase.ChatBaseExtended.CBMessage(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.Nid.Helpers.Chat.SendPlayerConf(User user, String[] message)
   at Eco.Nid.PlayerManager.Commands.Chat.Ann(IChatClient chatClient, String text, Int32 size, Boolean showAsPopUp, Boolean showAsOKBox, Boolean addToMail, String windowHeader, String tag)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.InvokeWithManyArguments(RuntimeMethodInfo mi, Int32 argCount, Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.<>c__DisplayClass16_0.<InvokeCommand>b__1()
   at Eco.Core.Utils.Async.TaskUtils.<>c__DisplayClass3_0.<RunWithExceptionLog>b__0()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.HandleCommandAsync(IChatClient chatClient, String text, SupportedLanguage language, INetObject target) System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Eco.EM.Framework.ChatBase.ChatBase.Message..ctor(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.EM.Framework.ChatBase.ChatBaseExtended.CBMessage(String content, User user, NotificationStyle messageCategory, NotificationCategory defaultChatTags)
   at Eco.Nid.Helpers.Chat.SendPlayerConf(User user, String[] message)
   at Eco.Nid.PlayerManager.Commands.Chat.Ann(IChatClient chatClient, String text, Int32 size, Boolean showAsPopUp, Boolean showAsOKBox, Boolean addToMail, String windowHeader, String tag)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.InvokeWithManyArguments(RuntimeMethodInfo mi, Int32 argCount, Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.<>c__DisplayClass16_0.<InvokeCommand>b__1()
   at Eco.Core.Utils.Async.TaskUtils.<>c__DisplayClass3_0.<RunWithExceptionLog>b__0()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Eco.Gameplay.Systems.Messaging.Chat.Commands.ChatCommandService.HandleCommandAsync(IChatClient chatClient, String text, SupportedLanguage language, INetObject target)```
JulianMa commented 8 months ago

@Dave247 DiscordLink is simply executing that command. If the target mod can't work with a command from a user, which is not logged in right now, its not a discord-link bug. We cannot login a user.

Dave247 commented 8 months ago

@Dave247 DiscordLink is simply executing that command. If the target mod can't work with a command from a user, which is not logged in right now, its not a discord-link bug. We cannot login a user.

This command supports RCON acroding to Nid, so the issue shouldn't be that it requires a logged in user. By my understanding it should then work with DL hence reporting it as a bug.

Dave247 commented 8 months ago

Monzun has replied regarding my updated issue, that the problem lies with the Elixir Mod framework. I'll try to see if it will work with other modded commands that don't require EM and create a new bug report if for some reason that still doesn't work, though I expect that it will work.

JulianMa commented 7 months ago

@Dave247 i found the bug inside EM Framework and reported it