test
This commit is contained in:
parent
59a3839eb7
commit
194ddbc8c4
10
setup.cfg
10
setup.cfg
@ -22,8 +22,10 @@ install_requires =
|
||||
|
||||
[options.entry_points]
|
||||
sopel.plugins =
|
||||
SpiceBotCore = sopel_SpiceBot_Core_1
|
||||
SpiceBotPrerun = sopel_SpiceBot_Core_Prerun
|
||||
SpiceBotStartup = sopel_SpiceBot_Core_Startup
|
||||
SpiceBotRuntimeCommands = sopel_SpiceBot_Runtime_Commands
|
||||
sopel_SpiceBot_Core_1 = sopel_SpiceBot_Core_1
|
||||
sopel_SpiceBot_Core_Prerun = sopel_SpiceBot_Core_Prerun
|
||||
sopel_SpiceBot_Core_Startup = sopel_SpiceBot_Core_Startup
|
||||
sopel_SpiceBot_Runtime_Commands = sopel_SpiceBot_Runtime_Commands
|
||||
sopel_SpiceBot_Runtime_Nickname_Commands = sopel_SpiceBot_Runtime_Nickname_Commands
|
||||
sopel_SpiceBot_Runtime_Action_Commands = sopel_SpiceBot_Runtime_Action_Commands
|
||||
spicemanip = spicemanip
|
||||
|
||||
@ -41,6 +41,24 @@ def prerun_nickname_command():
|
||||
return actual_decorator
|
||||
|
||||
|
||||
def prerun_action_command():
|
||||
|
||||
def actual_decorator(function):
|
||||
|
||||
@functools.wraps(function)
|
||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||
|
||||
trigger_command_type = str("nickname_command")
|
||||
|
||||
# Primary command used for trigger, and a list of all words
|
||||
trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type)
|
||||
|
||||
function(bot, trigger, *args, **kwargs)
|
||||
|
||||
return internal_prerun
|
||||
return actual_decorator
|
||||
|
||||
|
||||
def make_trigger_args(triggerargs_one, trigger_command_type='module'):
|
||||
trigger_args = spicemanip(triggerargs_one, 'create')
|
||||
if trigger_command_type in ['nickname_command']:
|
||||
|
||||
17
sopel_SpiceBot_Runtime_Action_Commands/__init__.py
Normal file
17
sopel_SpiceBot_Runtime_Action_Commands/__init__.py
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
from sopel import plugin
|
||||
|
||||
from sopel_SpiceBot_Core_1 import sb
|
||||
|
||||
from sopel_SpiceBot_Core_Prerun import prerun_action_command
|
||||
|
||||
|
||||
@prerun_action_command()
|
||||
@plugin.action_command('test')
|
||||
def sb_test_commands(bot, trigger):
|
||||
bot.say("Testing the bot")
|
||||
bot.say("Attributes: %s" % [x for x in dir(sb) if not x.startswith("__")])
|
||||
bot.say("%s" % sb.versions.dict)
|
||||
|
||||
sb.osd("test", trigger.sender)
|
||||
@ -4,47 +4,7 @@ from sopel import plugin
|
||||
|
||||
from sopel_SpiceBot_Core_1 import sb
|
||||
|
||||
from sopel_SpiceBot_Core_Prerun import prerun_nickname_command, prerun_command
|
||||
|
||||
|
||||
@prerun_nickname_command()
|
||||
@plugin.nickname_command('test')
|
||||
def sb_test_commands(bot, trigger):
|
||||
bot.say("Testing the bot")
|
||||
bot.say("Attributes: %s" % [x for x in dir(sb) if not x.startswith("__")])
|
||||
bot.say("%s" % sb.versions.dict)
|
||||
|
||||
sb.osd("test", trigger.sender)
|
||||
|
||||
|
||||
@prerun_nickname_command()
|
||||
@plugin.nickname_command('commands')
|
||||
def sopel_commands(bot, trigger):
|
||||
|
||||
bot.say("testing commands")
|
||||
|
||||
bot.say(str(bot.rules._rules.values()))
|
||||
|
||||
|
||||
@prerun_nickname_command()
|
||||
@plugin.nickname_command('nickname_commands')
|
||||
def sopel_nickname_commands(bot, trigger):
|
||||
bot.say("testing nickname_commands")
|
||||
|
||||
for x in sb.commands.sopel_nickname_commands:
|
||||
for y in x:
|
||||
bot.say(str(y))
|
||||
|
||||
|
||||
@prerun_nickname_command()
|
||||
@plugin.nickname_command('action_commands')
|
||||
def sopel_action_commands(bot, trigger):
|
||||
|
||||
bot.say("testing action_commands")
|
||||
|
||||
for x in sb.commands.sopel_action_commands:
|
||||
for y in x:
|
||||
bot.say(str(y))
|
||||
from sopel_SpiceBot_Core_Prerun import prerun_command
|
||||
|
||||
|
||||
@prerun_command()
|
||||
|
||||
17
sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py
Normal file
17
sopel_SpiceBot_Runtime_Nickname_Commands/__init__.py
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
from sopel import plugin
|
||||
|
||||
from sopel_SpiceBot_Core_1 import sb
|
||||
|
||||
from sopel_SpiceBot_Core_Prerun import prerun_nickname_command
|
||||
|
||||
|
||||
@prerun_nickname_command()
|
||||
@plugin.nickname_command('test')
|
||||
def sb_test_commands(bot, trigger):
|
||||
bot.say("Testing the bot")
|
||||
bot.say("Attributes: %s" % [x for x in dir(sb) if not x.startswith("__")])
|
||||
bot.say("%s" % sb.versions.dict)
|
||||
|
||||
sb.osd("test", trigger.sender)
|
||||
Loading…
Reference in New Issue
Block a user