Skip to content

Commit 460758f

Browse files
committed
use re.search not re.match in autotriggers
1 parent a318aa4 commit 460758f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
77
however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section.
88

9-
# v3.7.14-dev3
9+
# v3.7.14-dev4
1010

1111
### Added
1212

@@ -26,6 +26,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
2626

2727
- Mentioned `competing` as an activity type. ([PR #2902](https://github.com/kyb3r/modmail/pull/2902))
2828
- Level permissions were not checked if command permissions were set.
29+
- Regex autotriggers were not working if term was in the middle of strings.
2930

3031
### Internal
3132

bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.7.14-dev3"
1+
__version__ = "3.7.14-dev4"
22

33

44
import asyncio
@@ -949,10 +949,10 @@ async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context)
949949

950950
if self.config.get("use_regex_autotrigger"):
951951
trigger = next(
952-
filter(lambda x: re.match(x, message.content), self.auto_triggers.keys())
952+
filter(lambda x: re.search(x, message.content), self.auto_triggers.keys())
953953
)
954954
if trigger:
955-
invoker = re.match(trigger, message.content).group(0)
955+
invoker = re.search(trigger, message.content).group(0)
956956
else:
957957
trigger = next(
958958
filter(lambda x: x.lower() in message.content.lower(), self.auto_triggers.keys())

cogs/utility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,7 @@ async def autotrigger_test(self, ctx, *, text):
18291829
"""Tests a string against the current autotrigger setup"""
18301830
for keyword in self.bot.auto_triggers:
18311831
if self.bot.config.get("use_regex_autotrigger"):
1832-
check = re.match(keyword, text)
1832+
check = re.search(keyword, text)
18331833
regex = True
18341834
else:
18351835
check = keyword.lower() in text.lower()

0 commit comments

Comments
 (0)