Updated CLI client with newer URL and made rooms optional to test the behavior of Sneedchat with no room joined

This commit is contained in:
barelyprofessional
2024-06-09 14:58:17 +08:00
parent 6102a88721
commit 3ef573be5c
2 changed files with 8 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ public class ChatCliMain
_roomId = roomId;
_client = new ChatClient(new ChatClientConfigModel
{
WsUri = new Uri("wss://kiwifarms.st/chat.ws"),
WsUri = new Uri("wss://kiwifarms.st:9443/chat.ws"),
XfSessionToken = xfSessionToken
});
@@ -30,7 +30,11 @@ public class ChatCliMain
_client.OnWsReconnect += OnWsReconnected;
_client.StartWsClient().Wait();
_client.JoinRoom(_roomId);
if (_roomId != int.MaxValue)
{
_logger.Debug($"Joining room {_roomId}");
_client.JoinRoom(_roomId);
}
while (true)
{
@@ -79,6 +83,7 @@ public class ChatCliMain
private void OnWsReconnected(object sender, ReconnectionInfo reconnectionInfo)
{
AnsiConsole.MarkupLine($"[red]Reconnected due to {reconnectionInfo.Type}[/]");
if (_roomId == int.MaxValue) return;
AnsiConsole.MarkupLine($"[green]Rejoining {_roomId}[/]");
_client.JoinRoom(_roomId);
}

View File

@@ -14,7 +14,7 @@ namespace KfChatDotNetCli
[Option("debug", Required = false, Default = false, HelpText = "Enable debug logging")]
public bool Debug { get; set; }
[Option('r', "room", Required = true, HelpText = "Room ID to join on start")]
[Option('r', "room", Required = false, Default = int.MaxValue, HelpText = "Room ID to join on start")]
public int RoomId { get; set; }
}
static void Main(string[] args)