mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 14:39:54 -05:00
revert changes
This commit is contained in:
parent
5542635d65
commit
92fad5eb8f
@ -16,30 +16,12 @@ from .Commands import commands as botcommands
|
|||||||
from .Database import db as botdb
|
from .Database import db as botdb
|
||||||
|
|
||||||
|
|
||||||
def prerun(command_list, trigger_command_type='module'):
|
def prerun(trigger_command_type='module'):
|
||||||
|
|
||||||
if trigger_command_type == 'nickname':
|
|
||||||
def add_attribute(function):
|
|
||||||
if not hasattr(function, "nickname_commands"):
|
|
||||||
function.nickname_commands = []
|
|
||||||
function.nickname_commands.extend(command_list)
|
|
||||||
return function
|
|
||||||
return add_attribute
|
|
||||||
else:
|
|
||||||
def add_attribute(function):
|
|
||||||
if not hasattr(function, "commands"):
|
|
||||||
function.commands = []
|
|
||||||
function.commands.extend(command_list)
|
|
||||||
return function
|
|
||||||
return add_attribute
|
|
||||||
|
|
||||||
def actual_decorator(function):
|
def actual_decorator(function):
|
||||||
|
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_prerun(*args, **kwargs):
|
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
# Assign trigger and bot for easy access later
|
|
||||||
bot, trigger = args[0:2]
|
|
||||||
|
|
||||||
# Primary command used for trigger, and a list of all words
|
# Primary command used for trigger, and a list of all words
|
||||||
trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type)
|
trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type)
|
||||||
@ -65,7 +47,7 @@ def prerun(command_list, trigger_command_type='module'):
|
|||||||
if not trigger.sb["hyphen_arg"]:
|
if not trigger.sb["hyphen_arg"]:
|
||||||
# check if anything prohibits the nick from running the command
|
# check if anything prohibits the nick from running the command
|
||||||
if trigger_runstatus(bot, trigger):
|
if trigger_runstatus(bot, trigger):
|
||||||
function(*args, **kwargs)
|
function(bot, trigger, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
trigger_hyphen_arg_handler(bot, trigger)
|
trigger_hyphen_arg_handler(bot, trigger)
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||||
|
|
||||||
|
import sopel.module
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
|
||||||
@SpiceBot.prerun(['uptime'], 'module')
|
@sopel.module.nickname_commands('uptime')
|
||||||
def bot_command_uptime(bot, trigger):
|
def bot_command_uptime(bot, trigger):
|
||||||
timesince = str(SpiceBot.humanized_time(time.time() - SpiceBot.events.BOT_UPTIME)) + " ago."
|
timesince = str(SpiceBot.humanized_time(time.time() - SpiceBot.events.BOT_UPTIME)) + " ago."
|
||||||
bot.osd("I have been running since " + timesince)
|
bot.osd("I have been running since " + timesince)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user