SpiceBot-migrated/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display_Commands.py
2019-05-18 20:44:38 -04:00

24 lines
1.0 KiB
Python

# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
from sopel_modules.SpiceBot.Logs import botlogs
from sopel_modules.SpiceBot.Events import botevents
@sopel.module.event(botevents.BOT_COMMANDSQUERY)
@sopel.module.rule('.*')
def bot_startup_monologue_commands(bot, trigger):
availablecomsnum, availablecomsfiles = 0, 0
for commandstype in bot.memory['SpiceBot_CommandsQuery']['commands'].keys():
availablecomsnum += len(bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype].keys())
availablecomsfiles += bot.memory['SpiceBot_CommandsQuery']['counts']
bot.memory['SpiceBot_StartupMonologue'].append("There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.")
botlogs.log('SpiceBot_StartupMonologue', "There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.")
botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, "SpiceBot_StartupMonologue")