minerbot2/plugins/uwu_plugin.py

19 lines
470 B
Python

from bot import IRCLine
import importlib
import uwu
importlib.reload(uwu)
BOT = None
def on_uwu(event):
if not BOT: return
text = uwu.translate(" ".join(event.parts))
target = event.target if event.target.startswith("#") else event.hostmask.nick
prefix = ""
if target.startswith("#"): prefix=event.hostmask.nick+": "
BOT.socket.send(IRCLine("PRIVMSG",target,":"+prefix+text))
def register(bot):
global BOT
BOT = bot
bot.event_manager.on("command_uwu",on_uwu)