mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
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:
@@ -19,7 +19,7 @@ public class ChatCliMain
|
|||||||
_roomId = roomId;
|
_roomId = roomId;
|
||||||
_client = new ChatClient(new ChatClientConfigModel
|
_client = new ChatClient(new ChatClientConfigModel
|
||||||
{
|
{
|
||||||
WsUri = new Uri("wss://kiwifarms.st/chat.ws"),
|
WsUri = new Uri("wss://kiwifarms.st:9443/chat.ws"),
|
||||||
XfSessionToken = xfSessionToken
|
XfSessionToken = xfSessionToken
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -30,7 +30,11 @@ public class ChatCliMain
|
|||||||
_client.OnWsReconnect += OnWsReconnected;
|
_client.OnWsReconnect += OnWsReconnected;
|
||||||
|
|
||||||
_client.StartWsClient().Wait();
|
_client.StartWsClient().Wait();
|
||||||
_client.JoinRoom(_roomId);
|
if (_roomId != int.MaxValue)
|
||||||
|
{
|
||||||
|
_logger.Debug($"Joining room {_roomId}");
|
||||||
|
_client.JoinRoom(_roomId);
|
||||||
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -79,6 +83,7 @@ public class ChatCliMain
|
|||||||
private void OnWsReconnected(object sender, ReconnectionInfo reconnectionInfo)
|
private void OnWsReconnected(object sender, ReconnectionInfo reconnectionInfo)
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine($"[red]Reconnected due to {reconnectionInfo.Type}[/]");
|
AnsiConsole.MarkupLine($"[red]Reconnected due to {reconnectionInfo.Type}[/]");
|
||||||
|
if (_roomId == int.MaxValue) return;
|
||||||
AnsiConsole.MarkupLine($"[green]Rejoining {_roomId}[/]");
|
AnsiConsole.MarkupLine($"[green]Rejoining {_roomId}[/]");
|
||||||
_client.JoinRoom(_roomId);
|
_client.JoinRoom(_roomId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace KfChatDotNetCli
|
|||||||
|
|
||||||
[Option("debug", Required = false, Default = false, HelpText = "Enable debug logging")]
|
[Option("debug", Required = false, Default = false, HelpText = "Enable debug logging")]
|
||||||
public bool Debug { get; set; }
|
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; }
|
public int RoomId { get; set; }
|
||||||
}
|
}
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
|
|||||||
Reference in New Issue
Block a user