aboutsummaryrefslogtreecommitdiff
path: root/modules/youtube.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-08-31 12:55:52 +0100
committerGravatar dongfix2018-08-31 13:44:39 +0100
commitb7cf524e9869828ff85954cb731f7fee98bee8d9 (patch)
treed5d887ac82f3e50f0ea295953981363c1c5e7c5a /modules/youtube.py
parentRevert "Reformat" (diff)
Give modules event objects with "context"s, to facilitate purging all the event
hooks for a module
Diffstat (limited to 'modules/youtube.py')
-rw-r--r--modules/youtube.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/youtube.py b/modules/youtube.py
index df965ec0..1ffd4db5 100644
--- a/modules/youtube.py
+++ b/modules/youtube.py
@@ -17,15 +17,16 @@ ARROW_UP = "▲"
ARROW_DOWN = "▼"
class Module(object):
- def __init__(self, bot):
+ def __init__(self, bot, events):
self.bot = bot
- bot.events.on("received").on("command").on("yt", "youtube"
+ self.events = events
+ events.on("received").on("command").on("yt", "youtube"
).hook(self.yt,
help="Find a video on youtube", usage="[query]")
- bot.events.on("received").on("message").on("channel").hook(
+ events.on("received").on("message").on("channel").hook(
self.channel_message)
- bot.events.on("postboot").on("configure").on(
+ events.on("postboot").on("configure").on(
"channelset").assure_call(setting="auto-youtube",
help="Disable/Enable automatically getting info from youtube URLs",
validate=Utils.bool_or_none)
@@ -102,6 +103,6 @@ class Module(object):
youtube_id = match.group(1)
video_details = self.video_details(youtube_id)
if video_details:
- self.bot.events.on("send").on("stdout").call(target=event[
+ self.events.on("send").on("stdout").call(target=event[
"channel"], message=video_details, module_name="Youtube",
server=event["server"])