Use Contains instead of IndexOf

Co-authored-by: Berkan Diler <b.diler@gmx.de>
This commit is contained in:
Craftplacer 2021-05-27 09:48:30 +00:00 committed by GitHub
parent 2166ab87c6
commit 0b17af81f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -140,7 +140,7 @@ private void checkForMentions(Channel channel, Message message, string username)
/// Checks if <paramref name="message"/> contains <paramref name="username"/>, if not, retries making spaces into underscores.
/// </summary>
/// <returns>If the <paramref name="message"/> mentions the <paramref name="username"/></returns>
private static bool isMentioning(string message, string username) => message.IndexOf(username, StringComparison.OrdinalIgnoreCase) != -1 || message.IndexOf(username.Replace(' ', '_'), StringComparison.OrdinalIgnoreCase) != -1;
private static bool isMentioning(string message, string username) => message.Contains(username, StringComparison.OrdinalIgnoreCase) || message.Contains(username.Replace(' ', '_'), StringComparison.OrdinalIgnoreCase);
public class OpenChannelNotification : SimpleNotification
{