isengard-bot/commands.py

53 lines
857 B
Python

import pickle
import logging
from systemd.journal import JournalHandler
from data import HostData
# Logging
log = logging.getLogger(__name__)
log.addHandler(JournalHandler())
# Isengard commands
def cmdping(owners, nick, text, store):
"""
Ping command.
"""
return "pong !"
def cmdhelp(owners, nick, text, store):
"""
Ping command.
"""
global commandtable
msg = "je suis Isengard, le bot de supervision de ce salon.\n"
msg += "\n"
msg += "Voici la liste de mes commandes disponibles : \n"
for cmd in commandtable:
msg += "- " + cmd + "\n"
return msg
def cmdstatus(owners, nick, text, store):
"""
Status informations command.
"""
return "\n"+store.get_status()
# Commands
commandtable = {
"help" : cmdhelp,
"ping" : cmdping,
"status": cmdstatus
}