|
|
|
@ -159,16 +159,18 @@ class Plugin:
|
|
|
|
|
|
|
|
|
|
# Is it a question I can answer?
|
|
|
|
|
question = message[len(words[0]):].strip()
|
|
|
|
|
for q in self.config.get("questions", []):
|
|
|
|
|
if question.startswith(q):
|
|
|
|
|
content = question[len(q):].strip()
|
|
|
|
|
content = content.rstrip("?").rstrip()
|
|
|
|
|
question = Question(q, content)
|
|
|
|
|
self.question = question
|
|
|
|
|
self.bot.log_d(
|
|
|
|
|
f"Answering question from plugin {self.name}: {question}"
|
|
|
|
|
)
|
|
|
|
|
return True
|
|
|
|
|
for preamble in self.config.get("questions", []):
|
|
|
|
|
aliases = self.config.get("aliases", {}).get(preamble, [])
|
|
|
|
|
for q in (preamble, *aliases):
|
|
|
|
|
if question.startswith(q):
|
|
|
|
|
content = question[len(q):].strip()
|
|
|
|
|
content = content.rstrip("?").rstrip()
|
|
|
|
|
question = Question(preamble, content)
|
|
|
|
|
self.question = question
|
|
|
|
|
self.bot.log_d(
|
|
|
|
|
f"Answering from plugin {self.name}: {question}"
|
|
|
|
|
)
|
|
|
|
|
return True
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def should_handle_command(
|
|
|
|
@ -278,7 +280,7 @@ class Plugin:
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class Question:
|
|
|
|
|
preambule: str
|
|
|
|
|
preamble: str
|
|
|
|
|
content: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|