Compare commits

..

2 commits

Author SHA1 Message Date
dece 0a304f9b6c youtube_parser: support Invidious URLs 2022-03-06 17:26:48 +01:00
dece ed26c70095 misc_reactions: add nudge 2022-03-06 17:22:54 +01:00
3 changed files with 15 additions and 3 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))

View file

@ -12,7 +12,7 @@ from edmond.plugin import Plugin
class YoutubeParserPlugin(Plugin): class YoutubeParserPlugin(Plugin):
VIDEO_URL_RE = re.compile( VIDEO_URL_RE = re.compile(
r"https?:\/\/(?:www\.youtube\.com\/watch\?(?:.*&)?v=(?P<code1>[^&\s]+)" r"https?:\/\/(?:[^/]+/watch\?(?:.*&)?v=(?P<code1>[^&\s]+)"
r"|youtu\.be/(?P<code2>[^&\s]+))" r"|youtu\.be/(?P<code2>[^&\s]+))"
) )