1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 23:03:02 +08:00

Add chat /join command (#5602)

Add chat /join command
This commit is contained in:
Dean Herbert 2019-08-08 17:11:44 +09:00 committed by GitHub
commit a76d3f1218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,8 +213,27 @@ namespace osu.Game.Online.Chat
PostMessage(content, true);
break;
case "join":
if (string.IsNullOrWhiteSpace(content))
{
target.AddNewMessages(new ErrorMessage("Usage: /join [channel]"));
break;
}
var channel = availableChannels.Where(c => c.Name == content || c.Name == $"#{content}").FirstOrDefault();
if (channel == null)
{
target.AddNewMessages(new ErrorMessage($"Channel '{content}' not found."));
break;
}
JoinChannel(channel);
CurrentChannel.Value = channel;
break;
case "help":
target.AddNewMessages(new InfoMessage("Supported commands: /help, /me [action]"));
target.AddNewMessages(new InfoMessage("Supported commands: /help, /me [action], /join [channel]"));
break;
default: