As it says, the new clan chat feature does show up in the game chat channel. All clan chats are not private, they are displayed in game chat.
Clan chat showing in game chat channel on Discord
I came here to post the same thing. I also have another request to add a couple more Premium Plugins to the file. I have implemented Dome Event and Deep Sea Cargo on my modded server. It would be nice to have them included in a future release. I can send the file with my implementation to facilitate the addition.
Merged post
Disclaimer: I'm not a programmer and I hacked this together with ChatGPT. It appears to work on my test game and Discord servers. I'm going to add it to a production server tomorrow for live testing.
plugins/Rustcord.cs
Below Line 1495 inserted:
{ "RUST_OnPlayerClanChat", ":shield: {playername}: {message}"},
Starting line 1995 (1994 if you didn't add the above first). NOTE: I left original code commented in the rework.
#region Chat Logging
private void OnPlayerChat(BasePlayer player, string message, ConVar.Chat.ChatChannel channel)
{
if (Client == null) return;
if (player == null || message == null) return;
//Added by Terceran on 9/6/2024 to address an exception when the API Key is messed up
if (channel == null) return;
if (permission.UserHasPermission(player.UserIDString, "rustcord.hidechat")) return;
if (BetterChatMute?.Call<bool>("API_IsMuted", player.IPlayer) ?? false) return;
if (_settings.Filters.FilterWords != null && _settings.Filters.FilterWords.Count > 0)
{
for (int i = _settings.Filters.FilterWords.Count - 1; i >= 0; i--)
{
while (message.Contains(" " + _settings.Filters.FilterWords[i] + " ") || message.Contains(_settings.Filters.FilterWords[i]))
message = message.Replace(_settings.Filters.FilterWords[i], _settings.Filters.FilteredWord ?? "");
}
}
var text = GetPlayerCache(player, message, CacheType.OnPlayerChat);
/* for (int i = 0; i < _settings.Channels.Count; i++)
{
if (_settings.Channels[i].perms.Contains(channel == ConVar.Chat.ChatChannel.Team ? "msg_teamchat" : "msg_chat"))
{
if (!(player.IsValid())) continue;
GetChannel(Client, _settings.Channels[i].Channelid, chan =>
{
chan.CreateMessage(Client, Translate(channel == ConVar.Chat.ChatChannel.Team ? "RUST_OnPlayerTeamChat" : "RUST_OnPlayerChat", text));
});
}
} */
// REWORKED TO ENABLE msg_clanchat channel permission
for (int i = 0; i < _settings.Channels.Count; i++)
{
string chatPerm = GetChatPerm(channel);
if (_settings.Channels[i].perms.Contains(chatPerm))
{
if (!(player.IsValid())) continue;
GetChannel(Client, _settings.Channels[i].Channelid, chan =>
{
chan.CreateMessage(Client, Translate(GetChatLangKey(channel), text));
});
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
text.Clear();
}
// ADDED HELPERS FOR CLAN CHAT
private string GetChatPerm(ConVar.Chat.ChatChannel channel)
{
switch ((int)channel)
{
case 1:
return "msg_teamchat";
case 5:
return "msg_clanchat";
default:
return "msg_chat";
}
}
private string GetChatLangKey(ConVar.Chat.ChatChannel channel)
{
switch ((int)channel)
{
case 1:
return "RUST_OnPlayerTeamChat";
case 5:
return "RUST_OnPlayerClanChat";
default:
return "RUST_OnPlayerChat";
}
}
#endregionconfig/Rustcord.json
Add the "msg_clanchat" permission to a channel you want it recorded in.
lang/en/Rustcord.json
Add the same string below line 1495 to the file in JSON format.
"RUST_OnPlayerClanChat": ":shield: {playername}: {message}"