mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
add prerun step to check user/channel
This commit is contained in:
parent
4b0343e5de
commit
66a03df210
@ -28,6 +28,10 @@ def prerun(t_command_type='module', t_command_subtype=None):
|
|||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
|
# Verify channel and user exist
|
||||||
|
verify_channel(trigger)
|
||||||
|
verify_user(trigger)
|
||||||
|
|
||||||
botcom = class_create('botcom')
|
botcom = class_create('botcom')
|
||||||
|
|
||||||
if t_command_type == "nickname":
|
if t_command_type == "nickname":
|
||||||
@ -167,6 +171,29 @@ def prerun_query(t_command_type='module', t_command_subtype=None):
|
|||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
|
def verify_user(trigger):
|
||||||
|
# Identify
|
||||||
|
nick_id = botusers.whois_ident(trigger.nick)
|
||||||
|
# Verify nick is in the all list
|
||||||
|
botusers.add_to_all(trigger.nick, nick_id)
|
||||||
|
# Verify nick is in the all list
|
||||||
|
botusers.add_to_current(trigger.nick, nick_id)
|
||||||
|
# set current nick
|
||||||
|
botusers.mark_current_nick(trigger.nick, nick_id)
|
||||||
|
# add joined channel to nick list
|
||||||
|
botusers.add_channel(trigger.sender, nick_id)
|
||||||
|
# mark user as online
|
||||||
|
botusers.mark_user_online(nick_id)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_channel(trigger):
|
||||||
|
botchannels.add_channel(trigger.sender)
|
||||||
|
# Identify
|
||||||
|
nick_id = botchannels.whois_ident(trigger.nick)
|
||||||
|
# Verify nick is in the channel list
|
||||||
|
botchannels.add_to_channel(trigger.sender, trigger.nick, nick_id)
|
||||||
|
|
||||||
|
|
||||||
def make_trigger_args(triggerargs_one, trigger_command_type='module'):
|
def make_trigger_args(triggerargs_one, trigger_command_type='module'):
|
||||||
trigger_args = spicemanip.main(triggerargs_one, 'create')
|
trigger_args = spicemanip.main(triggerargs_one, 'create')
|
||||||
if trigger_command_type in ['nickname']:
|
if trigger_command_type in ['nickname']:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user