mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 06:29:54 -05:00
logging
This commit is contained in:
parent
947776e19e
commit
49feace919
@ -6,11 +6,9 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
|
||||
import sopel.module
|
||||
from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_Events.System import botevents
|
||||
from sopel_modules.SpiceBot_SBTools import (
|
||||
join_all_channels, chanadmin_all_channels, channel_list_current,
|
||||
bot_logging
|
||||
)
|
||||
from sopel_modules.SpiceBot_SBTools import join_all_channels, chanadmin_all_channels, channel_list_current,
|
||||
|
||||
import spicemanip
|
||||
|
||||
@ -44,7 +42,7 @@ botchannels = BotChannels()
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_Channels', "Starting setup procedure")
|
||||
botlogs.log('SpiceBot_Channels', "Starting setup procedure")
|
||||
botevents.startup_add([botevents.BOT_CHANNELS])
|
||||
|
||||
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
||||
@ -70,7 +68,7 @@ def trigger_channel_list_initial(bot, trigger):
|
||||
bot.write(['LIST'])
|
||||
bot.memory['SpiceBot_Channels']['ProcessLock'] = True
|
||||
|
||||
bot_logging(bot, 'SpiceBot_Channels', "Initial Channel list populating")
|
||||
botlogs.log('SpiceBot_Channels', "Initial Channel list populating")
|
||||
starttime = time.time()
|
||||
|
||||
while not bot.memory['SpiceBot_Channels']['InitialProcess']:
|
||||
@ -78,12 +76,12 @@ def trigger_channel_list_initial(bot, trigger):
|
||||
if timesince < 60:
|
||||
pass
|
||||
else:
|
||||
bot_logging(bot, 'SpiceBot_Channels', "Initial Channel list populating Timed Out")
|
||||
botlogs.log('SpiceBot_Channels', "Initial Channel list populating Timed Out")
|
||||
bot.memory['SpiceBot_Channels']['InitialProcess'] = True
|
||||
|
||||
channel_list_current(bot)
|
||||
foundchannelcount = len(bot.memory['SpiceBot_Channels']['channels'].keys())
|
||||
bot_logging(bot, 'SpiceBot_Channels', "Channel listing finished! " + str(foundchannelcount) + " channel(s) found.")
|
||||
botlogs.log('SpiceBot_Channels', "Channel listing finished! " + str(foundchannelcount) + " channel(s) found.")
|
||||
|
||||
join_all_channels(bot)
|
||||
chanadmin_all_channels(bot)
|
||||
@ -131,8 +129,8 @@ def trigger_channel_list_recurring(bot, trigger):
|
||||
def bot_part_empty(bot):
|
||||
"""Don't stay in empty channels"""
|
||||
ignorepartlist = []
|
||||
if bot.config.SpiceBot_Logs.logging_channel:
|
||||
ignorepartlist.append(bot.config.SpiceBot_Logs.logging_channel)
|
||||
if bot.config.core.logging_channel:
|
||||
ignorepartlist.append(bot.config.core.logging_channel)
|
||||
|
||||
for channel in bot.channels.keys():
|
||||
if len(bot.channels[channel].privileges.keys()) == 1 and channel not in ignorepartlist:
|
||||
|
||||
@ -7,14 +7,14 @@ import sopel.module
|
||||
|
||||
import os
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_Events.System import botevents
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
|
||||
import spicemanip
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_CommandsQuery', "Starting setup procedure")
|
||||
botlogs.log('SpiceBot_CommandsQuery', "Starting setup procedure")
|
||||
botevents.startup_add([botevents.BOT_COMMANDSQUERY])
|
||||
|
||||
if 'SpiceBot_CommandsQuery' not in bot.memory:
|
||||
@ -44,7 +44,7 @@ def setup(bot):
|
||||
pypi_modules_dir = os.path.join(plugin_dir, pathname)
|
||||
filepathlisting.append(pypi_modules_dir)
|
||||
except Exception as e:
|
||||
bot_logging(bot, 'SpiceBot_CommandsQuery', "sopel_modules not loaded :" + str(e))
|
||||
botlogs.log('SpiceBot_CommandsQuery', "sopel_modules not loaded :" + str(e))
|
||||
|
||||
# Extra directories
|
||||
filepathlist = []
|
||||
@ -154,7 +154,7 @@ def setup(bot):
|
||||
bot.memory['SpiceBot_CommandsQuery']['commands'][comtype][comalias] = {"aliasfor": maincom}
|
||||
|
||||
for comtype in ['module', 'nickname', 'rule']:
|
||||
bot_logging(bot, 'SpiceBot_CommandsQuery', "Found " + str(len(bot.memory['SpiceBot_CommandsQuery']['commands'][comtype].keys())) + " " + comtype + " commands.", True)
|
||||
botlogs.log('SpiceBot_CommandsQuery', "Found " + str(len(bot.memory['SpiceBot_CommandsQuery']['commands'][comtype].keys())) + " " + comtype + " commands.", True)
|
||||
|
||||
for command in bot.memory['SpiceBot_CommandsQuery']['commands']['rule'].keys():
|
||||
if command.startswith("$nickname"):
|
||||
@ -176,7 +176,7 @@ def bot_events_complete(bot, trigger):
|
||||
|
||||
for comtype in bot.memory['SpiceBot_CommandsQuery']['commands'].keys():
|
||||
if comtype not in ['module', 'nickname', 'rule']:
|
||||
bot_logging(bot, 'SpiceBot_CommandsQuery', "Found " + str(len(bot.memory['SpiceBot_CommandsQuery']['commands'][comtype].keys())) + " " + comtype + " commands.", True)
|
||||
botlogs.log('SpiceBot_CommandsQuery', "Found " + str(len(bot.memory['SpiceBot_CommandsQuery']['commands'][comtype].keys())) + " " + comtype + " commands.", True)
|
||||
|
||||
|
||||
def commandsquery_register(bot, command_type, validcoms, aliasfor=None):
|
||||
|
||||
@ -5,17 +5,18 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
|
||||
# sopel imports
|
||||
import sopel.module
|
||||
from sopel.tools import Identifier
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
from sopel.db import SopelDB, NickValues, ChannelValues
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
import json
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
|
||||
|
||||
def setup(bot):
|
||||
pass
|
||||
# Inject Database Functions
|
||||
bot_logging(bot, 'SpiceBot_Databaseaddons', "Implanting Database functions into bot")
|
||||
botlogs.log('SpiceBot_Databaseaddons', "Implanting Database functions into bot")
|
||||
SopelDB.delete_nick_value = SopelDBCache.delete_nick_value
|
||||
SopelDB.adjust_nick_value = SopelDBCache.adjust_nick_value
|
||||
SopelDB.delete_channel_value = SopelDBCache.delete_channel_value
|
||||
|
||||
@ -4,11 +4,12 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
|
||||
|
||||
# sopel imports
|
||||
import sopel.module
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_DatabaseCache', "Setting up Database Cache")
|
||||
botlogs.log('SpiceBot_DatabaseCache', "Setting up Database Cache")
|
||||
if 'SpiceBot_DatabaseCache' not in bot.memory:
|
||||
bot.memory['SpiceBot_DatabaseCache'] = dict()
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
import sopel.module
|
||||
from sopel.trigger import PreTrigger
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from .System import botevents
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
|
||||
import time
|
||||
|
||||
@ -23,7 +23,7 @@ def bot_startup_welcome(bot, trigger):
|
||||
@sopel.module.rule('.*')
|
||||
def bot_events_start(bot, trigger):
|
||||
"""This stage is redundant, but shows the system is working."""
|
||||
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
||||
botlogs.log('SpiceBot_Events', trigger.args[1], True)
|
||||
botevents.trigger(bot, botevents.BOT_READY, "Ready To Process module setup procedures")
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ def bot_startup_connection(bot, trigger):
|
||||
@sopel.module.rule('.*')
|
||||
def bot_events_startup_complete(bot, trigger):
|
||||
"""All events registered as required for startup have completed"""
|
||||
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
||||
botlogs.log('SpiceBot_Events', trigger.args[1], True)
|
||||
botevents.trigger(bot, botevents.BOT_LOADED, "All registered modules setup procedures have completed")
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ def bot_events_startup_complete(bot, trigger):
|
||||
@sopel.module.rule('.*')
|
||||
def bot_events_connected(bot, trigger):
|
||||
"""For items tossed in a queue, this will trigger then accordingly"""
|
||||
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
||||
botlogs.log('SpiceBot_Events', trigger.args[1], True)
|
||||
|
||||
while True:
|
||||
if len(botevents.SpiceBot_Events["trigger_queue"]):
|
||||
@ -72,4 +72,4 @@ def bot_events_connected(bot, trigger):
|
||||
@sopel.module.rule('.*')
|
||||
def bot_events_complete(bot, trigger):
|
||||
"""This is here simply to log to stderr that this was recieved."""
|
||||
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
|
||||
botlogs.log('SpiceBot_Events', trigger.args[1], True)
|
||||
|
||||
@ -7,8 +7,6 @@ import sopel
|
||||
from sopel.trigger import PreTrigger
|
||||
import functools
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
|
||||
|
||||
class BotEvents(object):
|
||||
"""A dynamic listing of all the notable Bot numeric events.
|
||||
@ -109,7 +107,3 @@ class BotEvents(object):
|
||||
|
||||
|
||||
botevents = BotEvents()
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_Events', "Starting setup procedure")
|
||||
|
||||
@ -5,11 +5,10 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
import sopel.module
|
||||
from sopel.config.types import StaticSection, ValidatedAttribute
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_Events.System import botevents
|
||||
|
||||
from sopel_modules.SpiceBot_CommandsQuery.CommandsQuery import commandsquery_register
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import read_directory_json_to_dict, bot_logging
|
||||
from sopel_modules.SpiceBot_SBTools import read_directory_json_to_dict
|
||||
|
||||
import spicemanip
|
||||
|
||||
@ -46,7 +45,7 @@ def configure(config):
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_GifSearch', "Starting Setup Procedure")
|
||||
botlogs.log('SpiceBot_GifSearch', "Starting Setup Procedure")
|
||||
botevents.startup_add([botevents.BOT_GIFSEARCH])
|
||||
|
||||
if 'SpiceBot_GifSearch' not in bot.memory:
|
||||
|
||||
@ -14,7 +14,8 @@ from sopel import tools, module
|
||||
from sopel.tools import Identifier
|
||||
from sopel.config.types import StaticSection, ValidatedAttribute
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
|
||||
|
||||
import time
|
||||
from collections import abc
|
||||
@ -34,12 +35,12 @@ def configure(config):
|
||||
def setup(bot):
|
||||
|
||||
# Inject KICK
|
||||
bot_logging(bot, 'SpiceBot_Kick', "Implanting Kick function into bot")
|
||||
botlogs.log('SpiceBot_Kick', "Implanting Kick function into bot")
|
||||
bot.kick = SopelKICK.kick
|
||||
sopel.bot.SopelWrapper.kick = SopelWrapperKICK.kick
|
||||
|
||||
# verify config settings for server
|
||||
bot_logging(bot, 'SpiceBot_Kick', "Checking for config settings")
|
||||
botlogs.log('SpiceBot_Kick', "Checking for config settings")
|
||||
bot.config.define_section("SpiceBot_Kick", SpiceBot_Kick, validate=False)
|
||||
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
import sopel.module
|
||||
|
||||
from sopel_modules.SpiceBot_Events.System import botevents
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
from .Logs import stdio_logs_fetch
|
||||
|
||||
from .Logs import botlogs, stdio_logs_fetch
|
||||
|
||||
|
||||
@sopel.module.event(botevents.BOT_STARTUPMONOLOGUE)
|
||||
@ -21,9 +21,9 @@ def bot_startup_monologue_start(bot, trigger):
|
||||
|
||||
if len(searchphrasefound):
|
||||
for foundphase in searchphrasefound:
|
||||
bot_logging(bot, 'SpiceBot_Logs', str(foundphase))
|
||||
botlogs.log('SpiceBot_Logs', str(foundphase))
|
||||
searchphrasefound.insert(0, "Notice to Bot Admins: ")
|
||||
searchphrasefound.append("Run the debug command for more information.")
|
||||
bot.osd(searchphrasefound, bot.channels.keys())
|
||||
else:
|
||||
bot_logging(bot, 'SpiceBot_Logs', "No issues found at bot startup!", True)
|
||||
botlogs.log('SpiceBot_Logs', "No issues found at bot startup!", True)
|
||||
|
||||
@ -10,7 +10,7 @@ import os
|
||||
import spicemanip
|
||||
|
||||
|
||||
class BotLogs():
|
||||
class botlogs():
|
||||
"""This Is a contained source of log information"""
|
||||
def __init__(self):
|
||||
self.SpiceBot_Logs = {
|
||||
@ -101,7 +101,7 @@ class BotLogs():
|
||||
return pidnum
|
||||
|
||||
|
||||
botlogs = BotLogs()
|
||||
botlogs = botlogs.log()
|
||||
|
||||
|
||||
@sopel.module.event('001')
|
||||
|
||||
@ -5,7 +5,8 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
|
||||
# sopel imports
|
||||
import sopel.module
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging, spicebot_reload
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_SBTools import spicebot_reload
|
||||
|
||||
|
||||
@sopel.module.nickname_commands('restart')
|
||||
@ -15,7 +16,7 @@ def nickname_comand_restart(bot, trigger):
|
||||
bot.say("You are not authorized to perform this function.")
|
||||
|
||||
quitmessage = "Received command from " + trigger.nick + " to restart. Be Back Soon!"
|
||||
bot_logging(bot, 'SpiceBot_Restart', quitmessage)
|
||||
botlogs.log('SpiceBot_Restart', quitmessage)
|
||||
bot.osd(quitmessage, bot.channels.keys())
|
||||
|
||||
# service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart')
|
||||
|
||||
@ -20,6 +20,8 @@ from pygit2 import clone_repository
|
||||
|
||||
import spicemanip
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
|
||||
|
||||
"""Variable References"""
|
||||
|
||||
@ -93,14 +95,6 @@ def command_permissions_check(bot, trigger, privslist):
|
||||
return True
|
||||
|
||||
|
||||
"""Logging"""
|
||||
|
||||
|
||||
def bot_logging(bot, logtype, logentry, stdio=False):
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
botlogs.log(logtype, logentry, stdio=False)
|
||||
|
||||
|
||||
"""
|
||||
Time
|
||||
"""
|
||||
@ -343,7 +337,7 @@ def spicebot_update(bot, deps=False):
|
||||
if not os.path.exists(clonepath) or not os.path.isdir(clonepath):
|
||||
os.system(clonepath)
|
||||
|
||||
bot_logging(bot, 'SpiceBot_Update', "Cloning to " + clonepath, True)
|
||||
botlogs.log('SpiceBot_Update', "Cloning to " + clonepath, True)
|
||||
|
||||
clone_repository(str(bot.config.SpiceBot_Update.gitrepo + ".git"), clonepath, checkout_branch=bot.config.SpiceBot_Update.gitbranch)
|
||||
|
||||
@ -354,12 +348,12 @@ def spicebot_update(bot, deps=False):
|
||||
# pipcommand += " git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)
|
||||
pipcommand += " /tmp/SpiceBot/"
|
||||
|
||||
bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`", True)
|
||||
botlogs.log('SpiceBot_Update', "Running `" + pipcommand + "`", True)
|
||||
# for line in os.popen(pipcommand).read().split('\n'):
|
||||
# bot_logging(bot, 'SpiceBot_Update', " " + line)
|
||||
# botlogs.log('SpiceBot_Update', " " + line)
|
||||
os.system(pipcommand)
|
||||
|
||||
bot_logging(bot, 'SpiceBot_Update', "Deleting " + clonepath, True)
|
||||
botlogs.log('SpiceBot_Update', "Deleting " + clonepath, True)
|
||||
|
||||
os.system("sudo rm -r /tmp/SpiceBot")
|
||||
|
||||
@ -375,10 +369,10 @@ def service_manip(bot, servicename, dowhat, log_from='service_manip'):
|
||||
if str(dowhat) not in ["start", "stop", "restart"]:
|
||||
return
|
||||
try:
|
||||
bot_logging(bot, log_from, str(dowhat).title() + "ing " + str(servicename) + ".service.")
|
||||
botlogs.log(log_from, str(dowhat).title() + "ing " + str(servicename) + ".service.")
|
||||
os.system("sudo service " + str(servicename) + " " + str(dowhat))
|
||||
except Exception as e:
|
||||
bot_logging(bot, log_from, str(dowhat).title() + "ing " + str(servicename) + ".service Failed: " + str(e))
|
||||
botlogs.log(log_from, str(dowhat).title() + "ing " + str(servicename) + ".service Failed: " + str(e))
|
||||
|
||||
|
||||
"""Config Reading Functions"""
|
||||
@ -410,7 +404,7 @@ def read_directory_json_to_dict(bot, directories, configtypename="Config File",
|
||||
except Exception as e:
|
||||
filereadgood = False
|
||||
if bot:
|
||||
bot_logging(bot, log_from, "Error loading %s: %s (%s)" % (configtypename, e, filepath))
|
||||
botlogs.log(log_from, "Error loading %s: %s (%s)" % (configtypename, e, filepath))
|
||||
dict_from_file = dict()
|
||||
# Close File
|
||||
inf.close()
|
||||
@ -425,10 +419,10 @@ def read_directory_json_to_dict(bot, directories, configtypename="Config File",
|
||||
|
||||
if filecount:
|
||||
if bot:
|
||||
bot_logging(bot, log_from, 'Registered %d %s dict files,' % (filecount, configtypename))
|
||||
bot_logging(bot, log_from, '%d %s dict files failed to load' % (fileopenfail, configtypename), True)
|
||||
botlogs.log(log_from, 'Registered %d %s dict files,' % (filecount, configtypename))
|
||||
botlogs.log(log_from, '%d %s dict files failed to load' % (fileopenfail, configtypename), True)
|
||||
else:
|
||||
if bot:
|
||||
bot_logging(bot, log_from, "Warning: Couldn't load any %s dict files" % (configtypename))
|
||||
botlogs.log(log_from, "Warning: Couldn't load any %s dict files" % (configtypename))
|
||||
|
||||
return configs_dict
|
||||
|
||||
@ -6,16 +6,15 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi
|
||||
import sopel
|
||||
import sopel.module
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging, stock_modules_begone
|
||||
|
||||
import os
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_SBTools import stock_modules_begone
|
||||
|
||||
|
||||
def setup(bot):
|
||||
|
||||
bot_logging(bot, 'Sopel_Patch', "Patching Sopels built-in url_callbacks")
|
||||
botlogs.log('Sopel_Patch', "Patching Sopels built-in url_callbacks")
|
||||
if 'url_callbacks' not in bot.memory:
|
||||
bot.memory['url_callbacks'] = sopel.tools.SopelMemory()
|
||||
|
||||
bot_logging(bot, 'Sopel_Patch', "Removing Stock Modules and verifying Dummy Command is present.")
|
||||
botlogs.log('Sopel_Patch', "Removing Stock Modules and verifying Dummy Command is present.")
|
||||
stock_modules_begone(bot)
|
||||
|
||||
@ -4,12 +4,12 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
|
||||
import sopel.module
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_Events.System import botevents
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_StartupMonologue', "Starting setup procedure")
|
||||
botlogs.log('SpiceBot_StartupMonologue', "Starting setup procedure")
|
||||
botevents.startup_add([botevents.BOT_STARTUPMONOLOGUE_CHANNELS, botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, botevents.BOT_STARTUPMONOLOGUE_CONNECTED])
|
||||
|
||||
if 'SpiceBot_StartupMonologue' not in bot.memory:
|
||||
|
||||
@ -4,8 +4,9 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
|
||||
import sopel.module
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_Events.System import botevents
|
||||
from sopel_modules.SpiceBot_SBTools import humanized_time, bot_logging
|
||||
from sopel_modules.SpiceBot_SBTools import humanized_time
|
||||
|
||||
import time
|
||||
|
||||
@ -15,7 +16,7 @@ import time
|
||||
def bot_startup_monologue_start(bot, trigger):
|
||||
|
||||
# Startup
|
||||
bot_logging(bot, 'SpiceBot_StartupMonologue', bot.nick + " is now starting. Please wait while I load my configuration")
|
||||
botlogs.log('SpiceBot_StartupMonologue', bot.nick + " is now starting. Please wait while I load my configuration")
|
||||
bot.osd(" is now starting. Please wait while I load my configuration.", bot.channels.keys(), 'ACTION')
|
||||
|
||||
botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE_CONNECTED, "SpiceBot_StartupMonologue")
|
||||
@ -31,7 +32,7 @@ def bot_startup_monologue_commands(bot, trigger):
|
||||
availablecomsfiles += bot.memory['SpiceBot_CommandsQuery']['counts']
|
||||
|
||||
bot.memory['SpiceBot_StartupMonologue'].append("There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.")
|
||||
bot_logging(bot, 'SpiceBot_StartupMonologue', "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")
|
||||
|
||||
@ -55,10 +56,10 @@ def bot_startup_monologue_display(bot, trigger):
|
||||
bot.memory['SpiceBot_StartupMonologue'].append("Startup took " + timesince)
|
||||
|
||||
# Announce to chan, then handle some closing stuff
|
||||
bot_logging(bot, 'SpiceBot_StartupMonologue', bot.nick + " startup complete")
|
||||
botlogs.log('SpiceBot_StartupMonologue', bot.nick + " startup complete")
|
||||
bot.memory['SpiceBot_StartupMonologue'].insert(0, " startup complete")
|
||||
|
||||
bot.osd(bot.memory['SpiceBot_StartupMonologue'], bot.channels.keys(), 'ACTION')
|
||||
|
||||
botevents.trigger(bot, botevents.BOT_STARTUPMONOLOGUE, "SpiceBot_StartupMonologue")
|
||||
bot_logging(bot, 'SpiceBot_StartupMonologue', "Startup Monologue has been issued to all channels.", True)
|
||||
botlogs.log('SpiceBot_StartupMonologue', "Startup Monologue has been issued to all channels.", True)
|
||||
|
||||
@ -8,7 +8,8 @@ from sopel.config.types import StaticSection, ValidatedAttribute
|
||||
|
||||
import spicemanip
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, bot_logging, spicebot_reload, spicebot_update
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, spicebot_reload, spicebot_update
|
||||
|
||||
|
||||
class SpiceBot_Update_MainSection(StaticSection):
|
||||
@ -23,7 +24,7 @@ def configure(config):
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot_logging(bot, 'SpiceBot_Update', "Initial Setup processing")
|
||||
botlogs.log('SpiceBot_Update', "Initial Setup processing")
|
||||
bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
|
||||
|
||||
|
||||
@ -48,7 +49,7 @@ def nickname_comand_update(bot, trigger):
|
||||
triggerargs = spicemanip.main(triggerargs, '2+', 'list')
|
||||
|
||||
quitmessage = "Received command from " + trigger.nick + " to update from Github and restart"
|
||||
bot_logging(bot, 'SpiceBot_Update', quitmessage)
|
||||
botlogs.log('SpiceBot_Update', quitmessage)
|
||||
bot.osd(quitmessage, bot.channels.keys())
|
||||
|
||||
if commandused == 'nodeps':
|
||||
|
||||
@ -6,15 +6,14 @@ import sopel.module
|
||||
|
||||
import time
|
||||
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
from sopel_modules.SpiceBot_SBTools import humanized_time
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
|
||||
|
||||
def setup(bot):
|
||||
if 'SpiceBot_Uptime' not in bot.memory:
|
||||
now = time.time()
|
||||
bot_logging(bot, 'SpiceBot_Uptime', "Start time set to " + str(time.time()))
|
||||
botlogs.log('SpiceBot_Uptime', "Start time set to " + str(time.time()))
|
||||
bot.memory["SpiceBot_Uptime"] = now
|
||||
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ from sopel import tools, module
|
||||
from sopel.tools import Identifier
|
||||
from sopel.config.types import StaticSection, ValidatedAttribute
|
||||
|
||||
from sopel_modules.SpiceBot_SBTools import bot_logging
|
||||
from sopel_modules.SpiceBot_Logs.Logs import botlogs
|
||||
|
||||
import time
|
||||
from collections import abc
|
||||
@ -39,7 +39,7 @@ def configure(config):
|
||||
def setup(bot):
|
||||
|
||||
# Inject OSD
|
||||
bot_logging(bot, 'SpiceBot_OSD', "Implanting OSD function into bot")
|
||||
botlogs.log('SpiceBot_OSD', "Implanting OSD function into bot")
|
||||
bot.osd = SopelOSD.osd
|
||||
sopel.bot.SopelWrapper.osd = SopelWrapperOSD.osd
|
||||
tools.get_available_message_bytes = ToolsOSD.get_available_message_bytes
|
||||
@ -47,7 +47,7 @@ def setup(bot):
|
||||
tools.get_message_recipientgroups = ToolsOSD.get_message_recipientgroups
|
||||
|
||||
# overwrite default bot messaging
|
||||
bot_logging(bot, 'SpiceBot_OSD', "Overwrite Default Sopel messaging commands")
|
||||
botlogs.log('SpiceBot_OSD', "Overwrite Default Sopel messaging commands")
|
||||
bot.osd = SopelOSD.osd
|
||||
bot.say = SopelOSD.say
|
||||
bot.action = SopelOSD.action
|
||||
@ -60,7 +60,7 @@ def setup(bot):
|
||||
sopel.bot.SopelWrapper.reply = SopelWrapperOSD.reply
|
||||
|
||||
# verify config settings for server
|
||||
bot_logging(bot, 'SpiceBot_OSD', "Checking for config settings")
|
||||
botlogs.log('SpiceBot_OSD', "Checking for config settings")
|
||||
bot.config.define_section("SpiceBot_OSD", SpiceBot_OSD, validate=False)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user