37 lines
1006 B
Python
37 lines
1006 B
Python
from irc_api import api
|
|
from irc_api.api import auto_help
|
|
|
|
|
|
@api.on(lambda m: "au revoir glados" in m.text.lower())
|
|
def greetings_bye(bot, msg, *args):
|
|
bot.send(msg.to, f"Au revoir {msg.author}")
|
|
|
|
|
|
@api.channel("#glados")
|
|
@api.on(
|
|
event=lambda m: "bonjour glados" in m.text.lower(),
|
|
desc="Réagis au 'bonjour glados' uniquement si le message est envoyé depuis le channel "\
|
|
"#glados."
|
|
)
|
|
def greetings_hello(bot, msg, *args):
|
|
bot.send(msg.to, f"Bonjour à toi")
|
|
|
|
|
|
@api.command("test")
|
|
def test(bot, msg, *args):
|
|
"""Test de module de fonction."""
|
|
bot.send(msg.to, f"arguments : {args}")
|
|
|
|
|
|
@api.channel("#glados")
|
|
def react_on_glados(bot, msg, *args):
|
|
"""Répète le dernier message envoyé sur #glados."""
|
|
if bot.history.get()[-1].author == msg.author:
|
|
bot.counter += 1
|
|
else:
|
|
bot.counter = 1
|
|
|
|
if bot.counter > 10:
|
|
bot.send(msg.to, f"Bon, {msg.author}, tu vas arrêter de spammer un jour ou bien ?")
|
|
bot.counter = 0
|