Edm0nd/edmond/plugins/horoscope.py

23 lines
590 B
Python

import time
from edmond.plugin import Plugin
from edmond.utils import http_get
class HoroscopePlugin(Plugin):
REQUIRED_CONFIGS = ["commands", "meditation", "delay", "url"]
def __init__(self, bot):
super().__init__(bot)
def on_pubmsg(self, event):
if not self.should_handle_command(event.arguments[0]):
return False
self.bot.say(event.target, self.config["meditation"])
time.sleep(self.config["delay"])
text = http_get(self.config["url"])
if text:
self.bot.say(event.target, text)
return True