misc_reactions: add nudge

This commit is contained in:
dece 2022-03-06 17:22:54 +01:00
parent dab1abf4c6
commit ed26c70095
2 changed files with 14 additions and 2 deletions

View file

@ -93,7 +93,7 @@
"miscreactions": { "miscreactions": {
"reactions": [ "reactions": [
"stop", "king", "mmm", "ooo", "detector", "question_marks", "stop", "king", "mmm", "ooo", "detector", "question_marks",
"repeat_letters" "repeat_letters", "nudge"
], ],
"rate": 0, "rate": 0,
"stop_message": "This was your last {subject}...", "stop_message": "This was your last {subject}...",
@ -102,7 +102,8 @@
"detector_message": "/me grabs its {subject} detector", "detector_message": "/me grabs its {subject} detector",
"detector_process": "...", "detector_process": "...",
"detector_pos": "OK go on...", "detector_pos": "OK go on...",
"detector_neg": "Halt!" "detector_neg": "Halt!",
"nudging": "/me nudges {target}"
}, },
"mood": { "mood": {
"commands": ["calm down"], "commands": ["calm down"],

View file

@ -1,5 +1,7 @@
import random import random
from irc.client import NickMask
from edmond.plugin import Plugin from edmond.plugin import Plugin
from edmond.utils import proc from edmond.utils import proc
@ -27,6 +29,7 @@ class MiscReactionsPlugin(Plugin):
"ooo", "ooo",
"detector", "detector",
"repeat_letters", "repeat_letters",
"nudge",
]) ])
def __init__(self, bot): def __init__(self, bot):
@ -162,3 +165,11 @@ class MiscReactionsPlugin(Plugin):
question_mark = self.config["question_mark"] question_mark = self.config["question_mark"]
reply = f"{word}{question_mark}" reply = f"{word}{question_mark}"
self.bot.say(event.target, reply) self.bot.say(event.target, reply)
def react_with_nudge(self, event):
"""Nudge the last person who talked (unsure how or why)."""
nick = NickMask(event.source).nick
reply = self.config.get("nudging")
if reply is None:
return
self.bot.say(event.target, reply.format(target=nick))