mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Merge pull request #26379 from wooster0/chat
Make chat command names case-insensitive
This commit is contained in:
commit
0f11743fff
@ -112,7 +112,7 @@ namespace osu.Game.Tests.Chat
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddStep("post message", () => channelManager.PostMessage("Something interesting"));
|
AddStep("post message", () => channelManager.PostMessage("Something interesting"));
|
||||||
AddUntilStep("message postesd", () => !channel.Messages.Any(m => m is LocalMessage));
|
AddUntilStep("message posted", () => !channel.Messages.Any(m => m is LocalMessage));
|
||||||
|
|
||||||
AddStep("post /help command", () => channelManager.PostCommand("help", channel));
|
AddStep("post /help command", () => channelManager.PostCommand("help", channel));
|
||||||
AddStep("post /me command with no action", () => channelManager.PostCommand("me", channel));
|
AddStep("post /me command with no action", () => channelManager.PostCommand("me", channel));
|
||||||
@ -146,6 +146,23 @@ namespace osu.Game.Tests.Chat
|
|||||||
AddAssert("channel has no more messages", () => channel.Messages, () => Is.Empty);
|
AddAssert("channel has no more messages", () => channel.Messages, () => Is.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCommandNameCaseInsensitivity()
|
||||||
|
{
|
||||||
|
Channel channel = null;
|
||||||
|
|
||||||
|
AddStep("join channel and select it", () =>
|
||||||
|
{
|
||||||
|
channelManager.JoinChannel(channel = createChannel(1, ChannelType.Public));
|
||||||
|
channelManager.CurrentChannel.Value = channel;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("post /me command", () => channelManager.PostCommand("ME DANCES"));
|
||||||
|
AddUntilStep("/me command received", () => channel.Messages.Last().Content.Contains("DANCES"));
|
||||||
|
AddStep("post /help command", () => channelManager.PostCommand("HeLp"));
|
||||||
|
AddUntilStep("/help command received", () => channel.Messages.Last().Content.Contains("Supported commands"));
|
||||||
|
}
|
||||||
|
|
||||||
private void handlePostMessageRequest(PostMessageRequest request)
|
private void handlePostMessageRequest(PostMessageRequest request)
|
||||||
{
|
{
|
||||||
var message = new Message(++currentMessageId)
|
var message = new Message(++currentMessageId)
|
||||||
|
@ -247,7 +247,7 @@ namespace osu.Game.Online.Chat
|
|||||||
string command = parameters[0];
|
string command = parameters[0];
|
||||||
string content = parameters.Length == 2 ? parameters[1] : string.Empty;
|
string content = parameters.Length == 2 ? parameters[1] : string.Empty;
|
||||||
|
|
||||||
switch (command)
|
switch (command.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "np":
|
case "np":
|
||||||
AddInternal(new NowPlayingCommand(target));
|
AddInternal(new NowPlayingCommand(target));
|
||||||
|
Loading…
Reference in New Issue
Block a user