Closed Npcfanatic21 closed 3 years ago
The crash log has this error:
Version: v1.15.5 (Stable)9/6/2021 7:35:51 PM: Critical error occurred
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at DiscordBot.DiscordBotMod.Dispose()
at Vintagestory.Common.ModLoader.Dispose()
at Vintagestory.Server.ServerMain.EnterRunPhase(EnumServerRunPhase runPhase)
at Vintagestory.Server.ServerMain.Stop(String reason)
at ._nBaeGh3axYe3gFJ2GK5q8eWmCoA(Object , EventArgs )
at VSPlatform.XPlatImplWin.ConsoleCtrlCheck(CtrlTypes ctrlType)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I can tell you're running the program on Windows, which I honestly haven't tested yet. I'll try running it on Windows and see if I can reproduce that error.
There's a second error in server-main.txt saying that the configuration file is bad, specifically around the DefaultChannel field:
Newtonsoft.Json.JsonReaderException: Invalid character after parsing property name. Expected ':' but got: ". Path 'DefaultChannel', line 4, position 4.
at Newtonsoft.Json.JsonTextReader.ParseProperty()
at Newtonsoft.Json.JsonReader.ReadAndAssert()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Vintagestory.Common.APIBase.LoadModConfig[T](String filename)
at DiscordBot.DiscordBotMod.StartServerSide(ICoreServerAPI api)
at Vintagestory.Common.ModLoader.TryStartSystem(Mod mod, ModSystem system, ICoreAPI api, ModEventPhase phase)
I'm guessing you deleted one of the quotes around that field. Here's what my config file looks like:
{
"DiscordToken": "REDACTED",
"DefaultChannel": {
"DiscordChannel": 884044009302003723,
"ChatToDiscord": true,
"ChatToGame": true
},
"IgnoreDiscordUsers": [],
"PlayerJoinMessage": "{0} joined.",
"PlayerLeaveMessage": "{0} left.",
"ServerStartMessage": "Server started.",
"ServerShutdownMessage": "Server shutdown.",
"PlayerDeathToDiscord": true,
"AllowMentions": false,
"ChannelOverrides": {
"gamegroupname": {
"DiscordChannel": 0,
"ChatToDiscord": true,
"ChatToGame": true
}
},
"LogScrapeRegexes": {
"^Message to all in group 0: (A .* temporal storm is imminent)$": "$1",
"^Message to all in group 0: (The temporal storm seems to be waning)$": "$1"
}
}
I havent touched any of the quotes in the config file. I can try again and see if it works.
still doesnt seem to work. and even coping what you put and replacing the 2 fields with the right info and still says failed to start discord bot
ok, so i figured out the dword reg thing. but its still not working and giving another error. i think. Heres both logs.
It looks like you fixed the json syntax error. It's definitely failing to start due to the System.Threading.Tasks.Extensions file.
6.9.2021 21:24:41 [Error] [discordbot] An exception was thrown when trying to start the mod:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at DiscordBot.DiscordBotMod.<StartDiscord>d__8.MoveNext()
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at DiscordBot.DiscordBotMod.StartDiscord()
at DiscordBot.DiscordBotMod.StartServerSide(ICoreServerAPI api)
at Vintagestory.Common.ModLoader.TryStartSystem(Mod mod, ModSystem system, ICoreAPI api, ModEventPhase phase)
That library is packaged inside the zip. I think it's having a version conflict. Maybe mono is more tolerant of different versions than Windows. I've got some ideas to try.
sounds good :) glad I could help.
I was able to reproduce the problem on Windows.
Previously I was targeting the net461 framework for discordbot. Discord.Net had a net461 target, but it was referencing a version of System.Threading.Tasks.Extensions without a net461 target. So I was previously trying to pin it to a newer version, which Nuget said should work. However, that newer version of System.Threading.Tasks.Extensions had a slightly different internal version number. On Linux Mono somehow didn't care about the version mismatch, but Windows refused to load it.
I ended up targeting netstandard20 instead for discordbot, because Discord.Net and System.Threading.Tasks.Extensions have targets for that at the correct versions.
The mod is working for me on Windows now. So I'm assuming this fixes the problem for you. Please open a new issue if it's still not working.
Fixed in v1.0.2.
ive input everything correctly into the mod config file but the bot still doesnt seem to connect. dont know what all you need, so ive attached both the crash log and the main log. Ive also added a screen shot when trying to run the /stop command when shutting down the server.
System is windows 10 OS
server-crash.txt server-main.txt