mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Use IndexOf
This commit is contained in:
@ -130,14 +130,7 @@ namespace osu.Game.Online.Chat
|
|||||||
/// Checks if <paramref name="message"/> contains <paramref name="username"/>, if not, retries making spaces into underscores.
|
/// Checks if <paramref name="message"/> contains <paramref name="username"/>, if not, retries making spaces into underscores.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>If the <paramref name="message"/> mentions the <paramref name="username"/></returns>
|
/// <returns>If the <paramref name="message"/> mentions the <paramref name="username"/></returns>
|
||||||
public bool IsMentioning(string message, string username)
|
public bool IsMentioning(string message, string username) => message.IndexOf(username, StringComparison.OrdinalIgnoreCase) != -1 || message.IndexOf(username.Replace(' ', '_'), StringComparison.OrdinalIgnoreCase) != -1;
|
||||||
{
|
|
||||||
// sanitize input to handle casing
|
|
||||||
message = message.ToLower();
|
|
||||||
username = username.ToLower();
|
|
||||||
|
|
||||||
return message.Contains(username) || message.Contains(username.Replace(' ', '_'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PrivateMessageNotification : SimpleNotification
|
public class PrivateMessageNotification : SimpleNotification
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user