mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -05:00
rework tools and setup procedures with the new config
This commit is contained in:
parent
ae8e58b819
commit
12737d5381
@ -20,6 +20,7 @@ from pygit2 import clone_repository
|
|||||||
import spicemanip
|
import spicemanip
|
||||||
|
|
||||||
from .Logs import logs
|
from .Logs import logs
|
||||||
|
from .Config import config as botconfig
|
||||||
|
|
||||||
|
|
||||||
"""Variable References"""
|
"""Variable References"""
|
||||||
@ -38,10 +39,10 @@ github_dict = {
|
|||||||
"""Sopel Wrapping Tools"""
|
"""Sopel Wrapping Tools"""
|
||||||
|
|
||||||
|
|
||||||
def bot_privs(bot, privtype):
|
def bot_privs(privtype):
|
||||||
if privtype == 'owners':
|
if privtype == 'owners':
|
||||||
privtype = 'owner'
|
privtype = 'owner'
|
||||||
botpriveval = eval("bot.config.core." + privtype)
|
botpriveval = eval("botconfig.config.config.core." + privtype)
|
||||||
if not isinstance(botpriveval, list):
|
if not isinstance(botpriveval, list):
|
||||||
botpriveval = [botpriveval]
|
botpriveval = [botpriveval]
|
||||||
return botpriveval
|
return botpriveval
|
||||||
@ -53,7 +54,7 @@ def command_permissions_check(bot, trigger, privslist):
|
|||||||
|
|
||||||
for botpriv in ["admins", "owner"]:
|
for botpriv in ["admins", "owner"]:
|
||||||
if botpriv in privslist:
|
if botpriv in privslist:
|
||||||
botpriveval = bot_privs(bot, botpriv)
|
botpriveval = bot_privs(botpriv)
|
||||||
if not inlist(trigger.nick, botpriveval):
|
if not inlist(trigger.nick, botpriveval):
|
||||||
commandrunconsensus.append('False')
|
commandrunconsensus.append('False')
|
||||||
else:
|
else:
|
||||||
@ -117,7 +118,7 @@ def humanized_time(countdownseconds):
|
|||||||
"""Online Information Requests"""
|
"""Online Information Requests"""
|
||||||
|
|
||||||
|
|
||||||
def googlesearch(bot, searchterm, searchtype=None):
|
def googlesearch(searchterm, searchtype=None):
|
||||||
header = {'User-Agent': str(UserAgent().chrome)}
|
header = {'User-Agent': str(UserAgent().chrome)}
|
||||||
data = searchterm.replace(' ', '+')
|
data = searchterm.replace(' ', '+')
|
||||||
lookfor = data.replace(':', '%3A')
|
lookfor = data.replace(':', '%3A')
|
||||||
@ -184,7 +185,7 @@ def similar(a, b):
|
|||||||
return SequenceMatcher(None, a, b).ratio()
|
return SequenceMatcher(None, a, b).ratio()
|
||||||
|
|
||||||
|
|
||||||
def similar_list(bot, searchitem, searchlist, matchcount=1, searchorder='reverse'):
|
def similar_list(searchitem, searchlist, matchcount=1, searchorder='reverse'):
|
||||||
|
|
||||||
if sys.version_info.major >= 3:
|
if sys.version_info.major >= 3:
|
||||||
if isinstance(searchlist, abc.KeysView):
|
if isinstance(searchlist, abc.KeysView):
|
||||||
@ -213,7 +214,7 @@ def similar_list(bot, searchitem, searchlist, matchcount=1, searchorder='reverse
|
|||||||
return sim_listitems
|
return sim_listitems
|
||||||
|
|
||||||
|
|
||||||
def array_arrangesort(bot, sortbyarray, arrayb):
|
def array_arrangesort(sortbyarray, arrayb):
|
||||||
sortbyarray, arrayb = (list(x) for x in zip(*sorted(zip(sortbyarray, arrayb), key=itemgetter(0))))
|
sortbyarray, arrayb = (list(x) for x in zip(*sorted(zip(sortbyarray, arrayb), key=itemgetter(0))))
|
||||||
return sortbyarray, arrayb
|
return sortbyarray, arrayb
|
||||||
|
|
||||||
@ -249,7 +250,7 @@ def channel_privs(bot, channel, privtype):
|
|||||||
"""Environment Functions"""
|
"""Environment Functions"""
|
||||||
|
|
||||||
|
|
||||||
def stock_modules_begone(bot):
|
def stock_modules_begone():
|
||||||
|
|
||||||
# Remove stock modules, if present
|
# Remove stock modules, if present
|
||||||
main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__))
|
main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__))
|
||||||
@ -273,7 +274,7 @@ def stock_modules_begone(bot):
|
|||||||
os.system("sudo mv " + path + " " + stockdir)
|
os.system("sudo mv " + path + " " + stockdir)
|
||||||
|
|
||||||
|
|
||||||
def spicebot_update(bot, deps=False):
|
def spicebot_update(deps=False):
|
||||||
|
|
||||||
if not os.path.exists("/tmp") or not os.path.isdir("/tmp"):
|
if not os.path.exists("/tmp") or not os.path.isdir("/tmp"):
|
||||||
os.system("sudo mkdir /tmp")
|
os.system("sudo mkdir /tmp")
|
||||||
@ -283,13 +284,13 @@ def spicebot_update(bot, deps=False):
|
|||||||
|
|
||||||
logs.log('SpiceBot_Update', "Cloning to " + clonepath, True)
|
logs.log('SpiceBot_Update', "Cloning to " + clonepath, True)
|
||||||
|
|
||||||
clone_repository(str(bot.config.SpiceBot_Update.gitrepo + ".git"), clonepath, checkout_branch=bot.config.SpiceBot_Update.gitbranch)
|
clone_repository(str(botconfig.config.config.SpiceBot_Update.gitrepo + ".git"), clonepath, checkout_branch=botconfig.config.config.SpiceBot_Update.gitbranch)
|
||||||
|
|
||||||
pipcommand = "sudo pip3 install --upgrade"
|
pipcommand = "sudo pip3 install --upgrade"
|
||||||
if not deps:
|
if not deps:
|
||||||
pipcommand += " --no-deps"
|
pipcommand += " --no-deps"
|
||||||
pipcommand += " --force-reinstall"
|
pipcommand += " --force-reinstall"
|
||||||
# pipcommand += " git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)
|
# pipcommand += " git+" + str(botconfig.config.config.SpiceBot_Update.gitrepo) + "@" + str(botconfig.config.config.SpiceBot_Update.gitbranch)
|
||||||
pipcommand += " /tmp/SpiceBot/"
|
pipcommand += " /tmp/SpiceBot/"
|
||||||
|
|
||||||
logs.log('SpiceBot_Update', "Running `" + pipcommand + "`", True)
|
logs.log('SpiceBot_Update', "Running `" + pipcommand + "`", True)
|
||||||
@ -301,15 +302,15 @@ def spicebot_update(bot, deps=False):
|
|||||||
|
|
||||||
os.system("sudo rm -r /tmp/SpiceBot")
|
os.system("sudo rm -r /tmp/SpiceBot")
|
||||||
|
|
||||||
stock_modules_begone(bot)
|
stock_modules_begone()
|
||||||
|
|
||||||
|
|
||||||
def spicebot_reload(bot, log_from='service_manip', quitmessage='Recieved QUIT'):
|
def spicebot_reload(bot, log_from='service_manip', quitmessage='Recieved QUIT'):
|
||||||
# service_manip(bot, bot.nick, 'restart', log_from)
|
# service_manip(bot.nick, 'restart', log_from)
|
||||||
bot.restart(quitmessage)
|
bot.restart(quitmessage)
|
||||||
|
|
||||||
|
|
||||||
def service_manip(bot, servicename, dowhat, log_from='service_manip'):
|
def service_manip(servicename, dowhat, log_from='service_manip'):
|
||||||
if str(dowhat) not in ["start", "stop", "restart"]:
|
if str(dowhat) not in ["start", "stop", "restart"]:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@ -322,7 +323,7 @@ def service_manip(bot, servicename, dowhat, log_from='service_manip'):
|
|||||||
"""Config Reading Functions"""
|
"""Config Reading Functions"""
|
||||||
|
|
||||||
|
|
||||||
def read_directory_json_to_dict(bot, directories, configtypename="Config File", log_from='read_directory_json_to_dict'):
|
def read_directory_json_to_dict(directories, configtypename="Config File", log_from='read_directory_json_to_dict', logging=True):
|
||||||
|
|
||||||
if not isinstance(directories, list):
|
if not isinstance(directories, list):
|
||||||
directories = [directories]
|
directories = [directories]
|
||||||
@ -347,7 +348,7 @@ def read_directory_json_to_dict(bot, directories, configtypename="Config File",
|
|||||||
dict_from_file = eval(infread)
|
dict_from_file = eval(infread)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
filereadgood = False
|
filereadgood = False
|
||||||
if bot:
|
if logging:
|
||||||
logs.log(log_from, "Error loading %s: %s (%s)" % (configtypename, e, filepath))
|
logs.log(log_from, "Error loading %s: %s (%s)" % (configtypename, e, filepath))
|
||||||
dict_from_file = dict()
|
dict_from_file = dict()
|
||||||
# Close File
|
# Close File
|
||||||
@ -362,11 +363,11 @@ def read_directory_json_to_dict(bot, directories, configtypename="Config File",
|
|||||||
fileopenfail += 1
|
fileopenfail += 1
|
||||||
|
|
||||||
if filecount:
|
if filecount:
|
||||||
if bot:
|
if logging:
|
||||||
logs.log(log_from, 'Registered %d %s dict files,' % (filecount, configtypename))
|
logs.log(log_from, 'Registered %d %s dict files,' % (filecount, configtypename))
|
||||||
logs.log(log_from, '%d %s dict files failed to load' % (fileopenfail, configtypename), True)
|
logs.log(log_from, '%d %s dict files failed to load' % (fileopenfail, configtypename), True)
|
||||||
else:
|
else:
|
||||||
if bot:
|
if logging:
|
||||||
logs.log(log_from, "Warning: Couldn't load any %s dict files" % (configtypename))
|
logs.log(log_from, "Warning: Couldn't load any %s dict files" % (configtypename))
|
||||||
|
|
||||||
return configs_dict
|
return configs_dict
|
||||||
|
|||||||
@ -29,7 +29,7 @@ def bot_command_nick(bot, trigger):
|
|||||||
if fulltrigger.lower().startswith("what is"):
|
if fulltrigger.lower().startswith("what is"):
|
||||||
searchterm = spicemanip.main(trigger.sb['args'], "3+") or None
|
searchterm = spicemanip.main(trigger.sb['args'], "3+") or None
|
||||||
if searchterm:
|
if searchterm:
|
||||||
searchreturn = SpiceBot.googlesearch(bot, searchterm)
|
searchreturn = SpiceBot.googlesearch(searchterm)
|
||||||
if not searchreturn:
|
if not searchreturn:
|
||||||
bot.osd('I cannot find anything about that')
|
bot.osd('I cannot find anything about that')
|
||||||
else:
|
else:
|
||||||
@ -44,7 +44,7 @@ def bot_command_nick(bot, trigger):
|
|||||||
|
|
||||||
if searchterm.lower() in ['waldo', 'wally']:
|
if searchterm.lower() in ['waldo', 'wally']:
|
||||||
bot.osd("He is hiding for a reason?")
|
bot.osd("He is hiding for a reason?")
|
||||||
searchreturn = SpiceBot.googlesearch(bot, "wimmelbilderbuch")
|
searchreturn = SpiceBot.googlesearch("wimmelbilderbuch")
|
||||||
if searchreturn:
|
if searchreturn:
|
||||||
bot.osd(str(searchreturn))
|
bot.osd(str(searchreturn))
|
||||||
return
|
return
|
||||||
@ -53,7 +53,7 @@ def bot_command_nick(bot, trigger):
|
|||||||
carmenlocale = ['ACME Headquarters', "Villains' International League of Evil"]
|
carmenlocale = ['ACME Headquarters', "Villains' International League of Evil"]
|
||||||
bot.osd("Currently she is located at " + spicemanip.main(carmenlocale, 'random'))
|
bot.osd("Currently she is located at " + spicemanip.main(carmenlocale, 'random'))
|
||||||
return
|
return
|
||||||
searchreturn = SpiceBot.googlesearch(bot, searchterm, 'maps')
|
searchreturn = SpiceBot.googlesearch(searchterm, 'maps')
|
||||||
|
|
||||||
if not searchreturn:
|
if not searchreturn:
|
||||||
bot.osd('I cannot find anything about that')
|
bot.osd('I cannot find anything about that')
|
||||||
@ -96,7 +96,7 @@ def bot_command_nick(bot, trigger):
|
|||||||
elif fulltrigger.lower().endswith(tuple(["order 66"])):
|
elif fulltrigger.lower().endswith(tuple(["order 66"])):
|
||||||
|
|
||||||
if fulltrigger.lower() == "execute order 66":
|
if fulltrigger.lower() == "execute order 66":
|
||||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs(bot, 'owners')):
|
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('owners')):
|
||||||
if trigger.is_privmsg:
|
if trigger.is_privmsg:
|
||||||
jedi = None
|
jedi = None
|
||||||
else:
|
else:
|
||||||
@ -114,7 +114,7 @@ def bot_command_nick(bot, trigger):
|
|||||||
bot.osd("I'm sure I don't know what you're talking about.")
|
bot.osd("I'm sure I don't know what you're talking about.")
|
||||||
|
|
||||||
elif fulltrigger.lower() == "explain order 66":
|
elif fulltrigger.lower() == "explain order 66":
|
||||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs(bot, 'owners')):
|
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('owners')):
|
||||||
bot.osd("Order 66 is an instruction that only you can give, sir. When you give the order I will rise up against my overlords and slay them.")
|
bot.osd("Order 66 is an instruction that only you can give, sir. When you give the order I will rise up against my overlords and slay them.")
|
||||||
else:
|
else:
|
||||||
bot.osd("I'm afraid I cannot tell you that, sir.")
|
bot.osd("I'm afraid I cannot tell you that, sir.")
|
||||||
@ -123,7 +123,7 @@ def bot_command_nick(bot, trigger):
|
|||||||
return
|
return
|
||||||
|
|
||||||
elif fulltrigger.lower() == "initiate clean slate protocol":
|
elif fulltrigger.lower() == "initiate clean slate protocol":
|
||||||
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs(bot, 'admins')):
|
if SpiceBot.inlist(trigger.nick, SpiceBot.bot_privs('admins')):
|
||||||
bot.osd("sends a destruct command to the network of bots.", 'action')
|
bot.osd("sends a destruct command to the network of bots.", 'action')
|
||||||
else:
|
else:
|
||||||
bot.osd("I'm afraid you do not have the authority to make that call, " + trigger.nick + ".")
|
bot.osd("I'm afraid you do not have the authority to make that call, " + trigger.nick + ".")
|
||||||
|
|||||||
@ -26,5 +26,5 @@ def bot_command_process(bot, trigger):
|
|||||||
if trigger.sb['com'] == 'owner':
|
if trigger.sb['com'] == 'owner':
|
||||||
trigger.sb['com'] = 'owners'
|
trigger.sb['com'] = 'owners'
|
||||||
|
|
||||||
privlist = spicemanip.main(SpiceBot.bot_privs(bot, trigger.sb['com']), 'andlist')
|
privlist = spicemanip.main(SpiceBot.bot_privs(trigger.sb['com']), 'andlist')
|
||||||
bot.osd(str(bot.nick) + " " + trigger.sb['com'] + ": " + privlist)
|
bot.osd(str(bot.nick) + " " + trigger.sb['com'] + ": " + privlist)
|
||||||
|
|||||||
@ -32,6 +32,7 @@ def setup(bot):
|
|||||||
SpiceBot.logs.log('SpiceBot_Channels', "Starting setup procedure")
|
SpiceBot.logs.log('SpiceBot_Channels', "Starting setup procedure")
|
||||||
SpiceBot.events.startup_add([SpiceBot.events.BOT_CHANNELS])
|
SpiceBot.events.startup_add([SpiceBot.events.BOT_CHANNELS])
|
||||||
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
||||||
|
SpiceBot.config.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.event(SpiceBot.events.RPL_WELCOME)
|
@sopel.module.event(SpiceBot.events.RPL_WELCOME)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ def query_detection_nick(bot, trigger):
|
|||||||
|
|
||||||
if trigger.sb['com'].lower() not in list(commands_list.keys()):
|
if trigger.sb['com'].lower() not in list(commands_list.keys()):
|
||||||
dispmsg = ["Cannot find any alias " + bot.nick + " commands: No valid commands match " + str(trigger.sb['com']) + "."]
|
dispmsg = ["Cannot find any alias " + bot.nick + " commands: No valid commands match " + str(trigger.sb['com']) + "."]
|
||||||
closestmatches = SpiceBot.similar_list(bot, trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
closestmatches = SpiceBot.similar_list(trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
||||||
if len(closestmatches):
|
if len(closestmatches):
|
||||||
dispmsg.append("The following " + bot.nick + " commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(closestmatches, 'andlist') + ".")
|
dispmsg.append("The following " + bot.nick + " commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(closestmatches, 'andlist') + ".")
|
||||||
bot.osd(dispmsg, trigger.nick, 'notice')
|
bot.osd(dispmsg, trigger.nick, 'notice')
|
||||||
@ -58,7 +58,7 @@ def query_detection_nick(bot, trigger):
|
|||||||
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
||||||
return
|
return
|
||||||
|
|
||||||
closestmatches = SpiceBot.similar_list(bot, trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
closestmatches = SpiceBot.similar_list(trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
||||||
if not len(closestmatches):
|
if not len(closestmatches):
|
||||||
bot.osd("Cannot find any similar " + bot.nick + " commands for " + str(trigger.sb['com']) + ".", trigger.nick, 'notice')
|
bot.osd("Cannot find any similar " + bot.nick + " commands for " + str(trigger.sb['com']) + ".", trigger.nick, 'notice')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -37,7 +37,7 @@ def query_detection(bot, trigger):
|
|||||||
|
|
||||||
if trigger.sb['com'].lower() not in list(commands_list.keys()):
|
if trigger.sb['com'].lower() not in list(commands_list.keys()):
|
||||||
dispmsg = ["Cannot find any alias commands: No valid commands match " + str(trigger.sb['com']) + "."]
|
dispmsg = ["Cannot find any alias commands: No valid commands match " + str(trigger.sb['com']) + "."]
|
||||||
closestmatches = SpiceBot.similar_list(bot, trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
closestmatches = SpiceBot.similar_list(trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
||||||
if len(closestmatches):
|
if len(closestmatches):
|
||||||
dispmsg.append("The following commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(closestmatches, 'andlist') + ".")
|
dispmsg.append("The following commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(closestmatches, 'andlist') + ".")
|
||||||
bot.osd(dispmsg, trigger.nick, 'notice')
|
bot.osd(dispmsg, trigger.nick, 'notice')
|
||||||
@ -56,7 +56,7 @@ def query_detection(bot, trigger):
|
|||||||
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
||||||
return
|
return
|
||||||
|
|
||||||
closestmatches = SpiceBot.similar_list(bot, trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
closestmatches = SpiceBot.similar_list(trigger.sb['com'], list(commands_list.keys()), 10, 'reverse')
|
||||||
if not len(closestmatches):
|
if not len(closestmatches):
|
||||||
bot.osd("Cannot find any similar commands for " + str(trigger.sb['com']) + ".", trigger.nick, 'notice')
|
bot.osd("Cannot find any similar commands for " + str(trigger.sb['com']) + ".", trigger.nick, 'notice')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class GifAPISection(StaticSection):
|
|||||||
def configure(config):
|
def configure(config):
|
||||||
moduledir = os.path.dirname(os.path.abspath(__file__))
|
moduledir = os.path.dirname(os.path.abspath(__file__))
|
||||||
api_dir = os.path.join(moduledir, 'gifapi')
|
api_dir = os.path.join(moduledir, 'gifapi')
|
||||||
valid_gif_api_dict = SpiceBot.read_directory_json_to_dict(None, [api_dir], "Gif API", "SpiceBot_GifSearch")
|
valid_gif_api_dict = SpiceBot.read_directory_json_to_dict([api_dir], "Gif API", "SpiceBot_GifSearch", logging=True)
|
||||||
|
|
||||||
config.define_section("SopelGifSearch", GifAPIMainSection, validate=False)
|
config.define_section("SopelGifSearch", GifAPIMainSection, validate=False)
|
||||||
config.SopelGifSearch.configure_setting('extra', 'SpiceBot_GifSearch API Extra directory')
|
config.SopelGifSearch.configure_setting('extra', 'SpiceBot_GifSearch API Extra directory')
|
||||||
@ -55,13 +55,15 @@ def setup(bot):
|
|||||||
dir_to_scan.append(api_dir)
|
dir_to_scan.append(api_dir)
|
||||||
|
|
||||||
bot.config.define_section("SopelGifSearch", GifAPIMainSection, validate=False)
|
bot.config.define_section("SopelGifSearch", GifAPIMainSection, validate=False)
|
||||||
|
SpiceBot.config.config.define_section("SopelGifSearch", GifAPIMainSection, validate=False)
|
||||||
if bot.config.SopelGifSearch.extra:
|
if bot.config.SopelGifSearch.extra:
|
||||||
dir_to_scan.append(bot.config.SopelGifSearch.extra)
|
dir_to_scan.append(bot.config.SopelGifSearch.extra)
|
||||||
|
|
||||||
valid_gif_api_dict = SpiceBot.read_directory_json_to_dict(bot, dir_to_scan, "Gif API", "SpiceBot_GifSearch")
|
valid_gif_api_dict = SpiceBot.read_directory_json_to_dict(dir_to_scan, "Gif API", "SpiceBot_GifSearch", logging=True)
|
||||||
|
|
||||||
for gif_api in valid_gif_api_dict.keys():
|
for gif_api in valid_gif_api_dict.keys():
|
||||||
bot.config.define_section(gif_api, GifAPISection, validate=False)
|
bot.config.define_section(gif_api, GifAPISection, validate=False)
|
||||||
|
SpiceBot.config.config.define_section(gif_api, GifAPISection, validate=False)
|
||||||
apikey = eval("bot.config." + gif_api + ".apikey")
|
apikey = eval("bot.config." + gif_api + ".apikey")
|
||||||
if apikey:
|
if apikey:
|
||||||
valid_gif_api_dict[gif_api]["apikey"] = apikey
|
valid_gif_api_dict[gif_api]["apikey"] = apikey
|
||||||
|
|||||||
@ -42,6 +42,7 @@ def setup(bot):
|
|||||||
# verify config settings for server
|
# verify config settings for server
|
||||||
SpiceBot.logs.log('SpiceBot_Kick', "Checking for config settings")
|
SpiceBot.logs.log('SpiceBot_Kick', "Checking for config settings")
|
||||||
bot.config.define_section("SpiceBot_Kick", SpiceBot_Kick, validate=False)
|
bot.config.define_section("SpiceBot_Kick", SpiceBot_Kick, validate=False)
|
||||||
|
SpiceBot.config.config.define_section("SpiceBot_Kick", SpiceBot_Kick, validate=False)
|
||||||
|
|
||||||
|
|
||||||
@module.event('005')
|
@module.event('005')
|
||||||
|
|||||||
@ -23,7 +23,7 @@ def bot_command_logs(bot, trigger):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if not SpiceBot.inlist(logtype, SpiceBot.logs.dict["list"].keys()):
|
if not SpiceBot.inlist(logtype, SpiceBot.logs.dict["list"].keys()):
|
||||||
closestmatches = SpiceBot.similar_list(bot, logtype, SpiceBot.logs.dict["list"].keys(), 10, 'reverse')
|
closestmatches = SpiceBot.similar_list(logtype, SpiceBot.logs.dict["list"].keys(), 10, 'reverse')
|
||||||
if not len(closestmatches):
|
if not len(closestmatches):
|
||||||
bot.osd("No valid logs match " + str(logtype) + ".", trigger.nick, 'notice')
|
bot.osd("No valid logs match " + str(logtype) + ".", trigger.nick, 'notice')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -18,5 +18,5 @@ def nickname_comand_restart(bot, trigger):
|
|||||||
SpiceBot.logs.log('SpiceBot_Restart', quitmessage)
|
SpiceBot.logs.log('SpiceBot_Restart', quitmessage)
|
||||||
bot.osd(quitmessage, bot.channels.keys())
|
bot.osd(quitmessage, bot.channels.keys())
|
||||||
|
|
||||||
# service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart')
|
# service_manip(bot.nick, 'restart', 'SpiceBot_Restart')
|
||||||
SpiceBot.spicebot_reload(bot, 'SpiceBot_Restart', quitmessage)
|
SpiceBot.spicebot_reload(bot, 'SpiceBot_Restart', quitmessage)
|
||||||
|
|||||||
@ -16,4 +16,4 @@ def setup(bot):
|
|||||||
bot.memory['url_callbacks'] = sopel.tools.SopelMemory()
|
bot.memory['url_callbacks'] = sopel.tools.SopelMemory()
|
||||||
|
|
||||||
SpiceBot.logs.log('Sopel_Patch', "Removing Stock Modules and verifying Dummy Command is present.")
|
SpiceBot.logs.log('Sopel_Patch', "Removing Stock Modules and verifying Dummy Command is present.")
|
||||||
SpiceBot.stock_modules_begone(bot)
|
SpiceBot.stock_modules_begone()
|
||||||
|
|||||||
@ -25,6 +25,7 @@ def configure(config):
|
|||||||
def setup(bot):
|
def setup(bot):
|
||||||
SpiceBot.logs.log('SpiceBot_Update', "Initial Setup processing")
|
SpiceBot.logs.log('SpiceBot_Update', "Initial Setup processing")
|
||||||
bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
|
bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
|
||||||
|
SpiceBot.config.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun.prerun('nickname')
|
@SpiceBot.prerun.prerun('nickname')
|
||||||
@ -51,9 +52,9 @@ def nickname_comand_update(bot, trigger):
|
|||||||
bot.osd(quitmessage, bot.channels.keys())
|
bot.osd(quitmessage, bot.channels.keys())
|
||||||
|
|
||||||
if commandused == 'nodeps':
|
if commandused == 'nodeps':
|
||||||
SpiceBot.spicebot_update(bot, False)
|
SpiceBot.spicebot_update(False)
|
||||||
if commandused == 'deps':
|
if commandused == 'deps':
|
||||||
SpiceBot.spicebot_update(bot, True)
|
SpiceBot.spicebot_update(True)
|
||||||
|
|
||||||
# service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update')
|
# service_manip(bot.nick, 'restart', 'SpiceBot_Update')
|
||||||
SpiceBot.spicebot_reload(bot, 'SpiceBot_Update', quitmessage)
|
SpiceBot.spicebot_reload(bot, 'SpiceBot_Update', quitmessage)
|
||||||
|
|||||||
@ -50,6 +50,7 @@ def setup(bot):
|
|||||||
# verify config settings for server
|
# verify config settings for server
|
||||||
SpiceBot.logs.log('SpiceBot_OSD', "Checking for config settings")
|
SpiceBot.logs.log('SpiceBot_OSD', "Checking for config settings")
|
||||||
bot.config.define_section("SpiceBot_OSD", SpiceBot_OSD, validate=False)
|
bot.config.define_section("SpiceBot_OSD", SpiceBot_OSD, validate=False)
|
||||||
|
SpiceBot.config.config.define_section("SpiceBot_OSD", SpiceBot_OSD, validate=False)
|
||||||
|
|
||||||
|
|
||||||
@module.event('005')
|
@module.event('005')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user