Ignore short path on messages mentioning the bot directly.
This commit is contained in:
@@ -20,10 +20,11 @@ class AIMessageBase(object):
|
||||
|
||||
|
||||
class AIMessage(AIMessageBase):
|
||||
def __init__(self, user: str, message: str, channel: str = "chat") -> None:
|
||||
def __init__(self, user: str, message: str, channel: str = "chat", direct: bool = False) -> None:
|
||||
self.user = user
|
||||
self.message = message
|
||||
self.channel = channel
|
||||
self.direct = direct
|
||||
|
||||
|
||||
class AIResponse(AIMessageBase):
|
||||
@@ -94,7 +95,7 @@ class AIResponder(object):
|
||||
response['hack'])
|
||||
|
||||
def short_path(self, message: AIMessage, limit: int) -> bool:
|
||||
if 'short-path' not in self.config:
|
||||
if message.direct or 'short-path' not in self.config:
|
||||
return False
|
||||
for chan_re, user_re in self.config['short-path']:
|
||||
chan_ma = re.match(chan_re, message.channel)
|
||||
|
||||
Reference in New Issue
Block a user