Edm0nd/edmond/plugins/horoscope.py

23 lines
590 B
Python
Raw Normal View History

import time
from edmond.plugin import Plugin
from edmond.utils import http_get
class HoroscopePlugin(Plugin):
2020-10-09 12:49:35 +02:00
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
2020-10-09 12:49:35 +02:00
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)
2020-10-09 12:19:58 +02:00
return True