GLaDOS/main.py

26 lines
624 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
2020-11-07 00:26:51 +01:00
2021-05-06 14:09:49 +02:00
import logging, re
2020-11-08 01:41:33 +01:00
from bot import Bot
2020-11-07 00:26:51 +01:00
2021-05-06 14:09:49 +02:00
LOG_FORMAT = "%(asctime)s [%(levelname)s] <%(filename)s> %(funcName)s: %(message)s"
logging.basicConfig(format=LOG_FORMAT, level=logging.DEBUG)
2020-11-07 00:26:51 +01:00
glados = Bot(
('irc.planet-casio.com', 6697),
2020-11-08 01:41:33 +01:00
('127.0.0.1', 5555),
["#general", "#glados"]
2020-11-07 00:26:51 +01:00
)
2021-05-06 14:09:49 +02:00
@glados.irc.on(lambda m: re.match("bonjour glados", m.text, re.IGNORECASE))
2020-11-08 01:41:33 +01:00
def say_hello(msg):
2021-05-06 14:09:49 +02:00
glados.irc.send(msg.to, f"Heureuse de vous revoir, {msg.author}")
2020-11-08 01:41:33 +01:00
2020-11-11 13:46:05 +01:00
@glados.v5.on(lambda c, m: True)
def announce(channels, message):
for c in channels:
glados.irc.send(c, message)
2020-11-07 00:26:51 +01:00
2020-11-08 01:41:33 +01:00
glados.start()