2022-02-06 01:54:17 +01:00
|
|
|
import pickle
|
2022-02-08 15:46:17 +01:00
|
|
|
import logging
|
|
|
|
from systemd.journal import JournalHandler
|
|
|
|
|
2022-02-08 20:25:51 +01:00
|
|
|
from data import HostData
|
|
|
|
|
2022-02-08 15:46:17 +01:00
|
|
|
# Logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
log.addHandler(JournalHandler())
|
|
|
|
|
2022-02-05 00:46:57 +01:00
|
|
|
|
|
|
|
# Isengard commands
|
|
|
|
|
2022-02-08 20:25:51 +01:00
|
|
|
def cmdping(owners, nick, text, store):
|
2022-02-05 00:46:57 +01:00
|
|
|
"""
|
|
|
|
Ping command.
|
|
|
|
"""
|
|
|
|
|
|
|
|
return "pong !"
|
|
|
|
|
2022-02-08 20:25:51 +01:00
|
|
|
def cmdhelp(owners, nick, text, store):
|
2022-02-07 18:39:34 +01:00
|
|
|
"""
|
|
|
|
Ping command.
|
|
|
|
"""
|
|
|
|
|
|
|
|
global commandtable
|
|
|
|
|
2022-02-08 20:25:51 +01:00
|
|
|
msg = "je suis Isengard, le bot de supervision de ce salon.\n"
|
2022-02-07 18:39:34 +01:00
|
|
|
msg += "\n"
|
|
|
|
msg += "Voici la liste de mes commandes disponibles : \n"
|
|
|
|
|
|
|
|
for cmd in commandtable:
|
|
|
|
msg += "- " + cmd + "\n"
|
|
|
|
|
|
|
|
return msg
|
2022-02-05 00:46:57 +01:00
|
|
|
|
2023-03-15 19:41:29 +01:00
|
|
|
def cmdstatus(owners, nick, text, store):
|
2022-02-06 01:29:59 +01:00
|
|
|
"""
|
2023-03-15 19:41:29 +01:00
|
|
|
Status informations command.
|
|
|
|
"""
|
2022-02-05 00:46:57 +01:00
|
|
|
|
2023-03-15 19:41:29 +01:00
|
|
|
return "\n"+store.get_status()
|
2022-02-05 00:46:57 +01:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
|
|
|
|
commandtable = {
|
2023-03-15 19:41:29 +01:00
|
|
|
"help" : cmdhelp,
|
|
|
|
"ping" : cmdping,
|
|
|
|
"status": cmdstatus
|
2022-02-05 00:46:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|