GsDChat.Client fixes:

- Command output not being displayed.
- Screen not cleaning up.
+ Better initial UI.
This commit is contained in:
tyuXX 2026-10-17 14:59:07 +03:00
parent b60b5a0774
commit 302d440dbd
12 changed files with 348 additions and 47 deletions

View file

@ -82,7 +82,8 @@ public class ModLoaderService
return new Core.Protocol.CommandResultPacket
{
Success = res.Success,
Output = res.Output
Output = res.Output,
ChannelId = client.ActiveChannelId
};
}
return null;

View file

@ -379,30 +379,30 @@ public class ChatWebSocketManager
" /delete <name> - Delete a channel (Admin)\n" +
" /users - List all registered users\n" +
" /motd - Display message of the day";
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = true, Output = helpText }, ct);
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = true, Output = helpText, ChannelId = packet.ChannelId }, ct);
break;
case "motd":
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = true, Output = $"MOTD: {_options.Motd}" }, ct);
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = true, Output = $"MOTD: {_options.Motd}", ChannelId = packet.ChannelId }, ct);
break;
case "users":
var users = await _db.GetAllUsersAsync();
var userListStr = string.Join("\n", users.Select(u => $" • {u.Username} [{u.Role}]"));
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = true, Output = $"Users:\n{userListStr}" }, ct);
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = true, Output = $"Users:\n{userListStr}", ChannelId = packet.ChannelId }, ct);
break;
case "delete":
string channelToDelete = (packet.Args ?? string.Empty).Trim().TrimStart('#');
if (string.IsNullOrEmpty(channelToDelete))
{
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = false, Output = "Usage: /delete <channel_name>" }, ct);
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = false, Output = "Usage: /delete <channel_name>", ChannelId = packet.ChannelId }, ct);
break;
}
var chToDelete = await _db.GetChannelByNameAsync(channelToDelete);
if (chToDelete == null)
{
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = false, Output = $"Channel #{channelToDelete} not found." }, ct);
await client.SendMessageAsync(MessageTypes.CommandResult, new CommandResultPacket { Success = false, Output = $"Channel #{channelToDelete} not found.", ChannelId = packet.ChannelId }, ct);
break;
}
await HandleDeleteChannelAsync(client, chToDelete.Id, ct);