Hi MJSU,
We’re encountering an issue with DiscordChat v3.0.6 when a user sends a message from Discord into the server chat channel. If the user is not linked (i.e., not recognized by player.IsLinked()), the plugin throws an exception:
[DiscordExtension] [Exception]: An exception occurred for discord subscription in channel [ID] for plugin DiscordChat by MJSU v3.0.6
(ArgumentNullException: Value cannot be null. Parameter name: key)
at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key)
at Oxide.Ext.Discord.Data.Ip.DiscordIpData.GetCountryCode (System.String ip)
...
From what we can tell, the plugin is trying to resolve the country flag emoji using a null IP address, which occurs because the placeholder ${DefaultKeys.Player.CountryEmoji} is being used even when the Discord user isn't linked to an in-game player.
Current Setup:
Players link through DiscordAuth, not DiscordCore.
We currently have
"Allow Unlinked Players To Chat With Server": true.The issue only occurs when an unlinked Discord user sends a message.
Open Questions / Suggestions:
Should we be switching to DiscordCore instead of DiscordAuth for proper linking?
Is there a way to make DiscordAuth-compatible users count as "linked"?
Would it be possible to add a null check around the IP in the placeholder system to avoid this crash for unlinked users?
Alternatively, could the placeholder fall back to a generic emoji if no IP is available?
We're open to suggestions on how to fix our setup too — just want to get it running smoothly and avoid this crash.
Thanks again for your work on the plugin!
Cheers,
Orangemart
Edit:
We just realized this might be related to a change we made in the lang/en/discordchat.json file. Specifically, we’re using {player.country.emoji} in both the "V3.Discord.Chat.Server" and "V3.Discord.Chat.LinkedMessage" lines. That placeholder likely expects a valid IP from a linked player, which wouldn't exist when someone is unlinked (e.g. using DiscordAuth rather than DiscordCore).
We’ve removed {player.country.emoji} from those lines for now.