This commit is contained in:
deathbybandaid 2019-05-31 13:28:09 -04:00
parent 4642d784e4
commit 9ddcc55ab2
9 changed files with 42 additions and 57 deletions

View File

@ -0,0 +1,12 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""
This is the SpiceBot Update system.
"""
from sopel.config.types import StaticSection, ValidatedAttribute
class SpiceBot_Update_MainSection(StaticSection):
gitrepo = ValidatedAttribute('gitrepo', default="https://github.com/SpiceBot/SpiceBot")
gitbranch = ValidatedAttribute('gitbranch', default="master")

View File

@ -9,6 +9,8 @@ This module contains references only for other modules to utilize.
from .configure import *
from .setup import *
from .Update import *
from .Config import *
from .Tools import *
from .Prerun import *

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
"""Configuration for SpiceBot"""
from .Channels import SpiceBot_Channels_MainSection
from .Update import SpiceBot_Update_MainSection
def configure(config):
@ -12,3 +13,7 @@ def configure(config):
config.SpiceBot_Channels.configure_setting('joinall', 'SpiceBot_Channels JOIN New Channels')
config.SpiceBot_Channels.configure_setting('operadmin', 'SpiceBot_Channels OPER ADMIN MODE')
config.SpiceBot_Channels.configure_setting('chanignore', 'SpiceBot_Channels Ignore JOIN for channels')
config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
config.SpiceBot_Update.configure_setting('gitrepo', 'SpiceBot_Update git repo to install')
config.SpiceBot_Update.configure_setting('gitbranch', 'SpiceBot_Update git branch to install')

View File

@ -4,9 +4,11 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
import os
from .Config import config as botconfig
from .Logs import logs
from .Channels import SpiceBot_Channels_MainSection
from .Update import SpiceBot_Update_MainSection
def setup(bot):
@ -20,7 +22,9 @@ def setup(bot):
bot.config.core.logs_raw = os.path.join(bot.config.core.logdir, 'raw.log')
# bot.config.core.logs_raw = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.raw.log')
# logs.log('SpiceBot_Logs', "Setting Up Configuration")
logs.log('SpiceBot_Channels', "Setting Up Configuration")
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
logs.log('SpiceBot_Update', "Initial Setup processing")
bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
botconfig.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)

View File

@ -1,33 +1,14 @@
#!/usr/bin/env python
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
# sopel imports
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
from sopel.config.types import StaticSection, ValidatedAttribute
import spicemanip
import sopel_modules.SpiceBot as SpiceBot
class SpiceBot_Update_MainSection(StaticSection):
gitrepo = ValidatedAttribute('gitrepo', default="https://github.com/SpiceBot/SpiceBot")
gitbranch = ValidatedAttribute('gitbranch', default="master")
def configure(config):
config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
config.SpiceBot_Update.configure_setting('gitrepo', 'SpiceBot_Update git repo to install')
config.SpiceBot_Update.configure_setting('gitbranch', 'SpiceBot_Update git branch to install')
def setup(bot):
SpiceBot.logs.log('SpiceBot_Update', "Initial Setup processing")
bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
SpiceBot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False)
@SpiceBot.prerun.prerun('nickname')
@sopel.module.nickname_commands('update')
def nickname_comand_update(bot, trigger):
@ -58,3 +39,17 @@ def nickname_comand_update(bot, trigger):
# service_manip(bot.nick, 'restart', 'SpiceBot_Update')
SpiceBot.spicebot_reload(bot, 'SpiceBot_Update', quitmessage)
@sopel.module.nickname_commands('restart')
def nickname_comand_restart(bot, trigger):
if not trigger.admin:
bot.osd("You are not authorized to perform this function.")
quitmessage = "Received command from " + trigger.nick + " to restart. Be Back Soon!"
SpiceBot.logs.log('SpiceBot_Restart', quitmessage)
bot.osd(quitmessage, bot.channels.keys())
# service_manip(bot.nick, 'restart', 'SpiceBot_Restart')
SpiceBot.spicebot_reload(bot, 'SpiceBot_Restart', quitmessage)

View File

@ -10,6 +10,7 @@ from .Commands import *
from .Channels import *
from .Database import *
from .Uptime import *
from .Runtime_Controls import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'

View File

@ -1,22 +0,0 @@
#!/usr/bin/env python
# coding=utf-8
from __future__ import unicode_literals, absolute_import, print_function, division
# sopel imports
import sopel.module
import sopel_modules.SpiceBot as SpiceBot
@sopel.module.nickname_commands('restart')
def nickname_comand_restart(bot, trigger):
if not trigger.admin:
bot.osd("You are not authorized to perform this function.")
quitmessage = "Received command from " + trigger.nick + " to restart. Be Back Soon!"
SpiceBot.logs.log('SpiceBot_Restart', quitmessage)
bot.osd(quitmessage, bot.channels.keys())
# service_manip(bot.nick, 'restart', 'SpiceBot_Restart')
SpiceBot.spicebot_reload(bot, 'SpiceBot_Restart', quitmessage)

View File

@ -1,6 +0,0 @@
# coding=utf-8
"""Event Parsing from IRC
"""
from __future__ import unicode_literals, absolute_import, print_function, division
from .Restart import *

View File

@ -1,6 +0,0 @@
# coding=utf-8
"""Event Parsing from IRC
"""
from __future__ import unicode_literals, absolute_import, print_function, division
from .Update import *