Skip to content

Commit

Permalink
Merge pull request #463 from Ixrec/case-insensitive-witties
Browse files Browse the repository at this point in the history
make witties case-insensitive
  • Loading branch information
Ixrec authored Aug 11, 2023
2 parents 9971572 + 13dff7d commit 4b4031b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Izzy-Moonbot/Describers/ConfigDescriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public ConfigDescriber()
_config.Add("Witties",
new ConfigItem(ConfigItemType.StringDictionary,
"A map from message patterns to automated Izzy responses. Also known as an 'autoresponder.'\n" +
"For example, `.config Witties set \"izzy\" \"that's my name!\"` will make Izzy post \"that's my name!\" whenever anyone posts a message containing \"izzy\".\n" +
"For example, `.config Witties set \"izzy\" \"that's my name!\"` will make Izzy post \"that's my name!\" whenever anyone posts a message containing \"izzy\" (or any capitalization thereof).\n" +
"This will only happen if the message is in one of the `WittyChannels` channels, and no witty response has been posted within the last `WittyCooldown` seconds, and the message author is not a bot.\n" +
"Currently, there is no special pattern matching syntax; the 'patterns' are just strings taken literally. No wildcards or regexes.",
ConfigItemCategory.Witty));
Expand Down
4 changes: 2 additions & 2 deletions Izzy-Moonbot/EventListeners/MessageListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ private async Task ProcessMessageReceived(
if (author.Id == client.CurrentUser.Id) return; // Don't process self.
if (author.IsBot) return; // Don't listen to bots

var content = message.Content;
var match = _config.Witties.FirstOrDefault(pair => content.Contains(pair.Key));
var content = message.Content.ToLower();
var match = _config.Witties.FirstOrDefault(pair => content.Contains(pair.Key.ToLower()));
if (match.Key == null)
return;

Expand Down

0 comments on commit 4b4031b

Please sign in to comment.