revert changes

This commit is contained in:
deathbybandaid 2019-06-25 08:24:32 -04:00
parent 5542635d65
commit 92fad5eb8f
2 changed files with 6 additions and 22 deletions

View File

@ -16,30 +16,12 @@ from .Commands import commands as botcommands
from .Database import db as botdb
def prerun(command_list, 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 prerun(trigger_command_type='module'):
def actual_decorator(function):
@functools.wraps(function)
def internal_prerun(*args, **kwargs):
# Assign trigger and bot for easy access later
bot, trigger = args[0:2]
def internal_prerun(bot, trigger, *args, **kwargs):
# Primary command used for trigger, and a list of all words
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"]:
# check if anything prohibits the nick from running the command
if trigger_runstatus(bot, trigger):
function(*args, **kwargs)
function(bot, trigger, *args, **kwargs)
else:
trigger_hyphen_arg_handler(bot, trigger)

View File

@ -2,12 +2,14 @@
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
import time
import sopel_modules.SpiceBot as SpiceBot
@SpiceBot.prerun(['uptime'], 'module')
@sopel.module.nickname_commands('uptime')
def bot_command_uptime(bot, trigger):
timesince = str(SpiceBot.humanized_time(time.time() - SpiceBot.events.BOT_UPTIME)) + " ago."
bot.osd("I have been running since " + timesince)