Skip to content

Commit

Permalink
Fix not all messages going through the new chatbox system
Browse files Browse the repository at this point in the history
  • Loading branch information
LucHeart committed Jun 8, 2024
1 parent 77af213 commit 1278666
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 8 additions & 0 deletions ShockOsc/Services/ChatboxService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public async ValueTask SendRemoteControlMessage(string shockerName, string sende

await _messageChannel.Writer.WriteAsync(new Message(msg, _configManager.Config.Chatbox.TimeoutTimeSpan));
}

public async ValueTask SendGenericMessage(string message)
{
if (!_configManager.Config.Chatbox.Enabled) return;

var msg = $"{_configManager.Config.Chatbox.Prefix}{message}";
await _messageChannel.Writer.WriteAsync(new Message(msg, _configManager.Config.Chatbox.TimeoutTimeSpan));
}

private async Task MessageLoop()
{
Expand Down
10 changes: 4 additions & 6 deletions ShockOsc/Services/ShockOsc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ private async Task FoundVrcClient(IPEndPoint? oscClient)

_logger.LogInformation("Ready");
OsTask.Run(_underscoreConfig.SendUpdateForAll);

await _oscClient.SendChatboxMessage($"{_configManager.Config.Chatbox.Prefix} Game Connected");
await _chatboxService.SendGenericMessage("Game Connected");
}

private Task OnAvatarChange(Dictionary<string, object?> parameters, string avatarId)
Expand Down Expand Up @@ -379,8 +379,7 @@ private ValueTask LogIgnoredKillSwitchActive()
if (string.IsNullOrEmpty(_configManager.Config.Chatbox.IgnoredKillSwitchActive))
return ValueTask.CompletedTask;

return _oscClient.SendChatboxMessage(
$"{_configManager.Config.Chatbox.Prefix}{_configManager.Config.Chatbox.IgnoredKillSwitchActive}");
return _chatboxService.SendGenericMessage(_configManager.Config.Chatbox.IgnoredKillSwitchActive);
}

private ValueTask LogIgnoredAfk()
Expand All @@ -389,8 +388,7 @@ private ValueTask LogIgnoredAfk()
if (string.IsNullOrEmpty(_configManager.Config.Chatbox.IgnoredAfk))
return ValueTask.CompletedTask;

return _oscClient.SendChatboxMessage(
$"{_configManager.Config.Chatbox.Prefix}{_configManager.Config.Chatbox.IgnoredAfk}");
return _chatboxService.SendGenericMessage(_configManager.Config.Chatbox.IgnoredAfk);
}

private async Task SenderLoopAsync()
Expand Down
4 changes: 2 additions & 2 deletions ShockOsc/ShockOsc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<AssemblyName>OpenShock.ShockOsc</AssemblyName>
<RootNamespace>OpenShock.ShockOsc</RootNamespace>
<Company>OpenShock</Company>
<AssemblyVersion>2.1.0</AssemblyVersion>
<Version>2.1.0</Version>
<AssemblyVersion>2.1.1</AssemblyVersion>
<Version>2.1.1</Version>
<ApplicationIcon>Resources\openshock-icon.ico</ApplicationIcon>
<SelfContained>true</SelfContained>
<Product>ShockOsc</Product>
Expand Down

0 comments on commit 1278666

Please sign in to comment.