Update Messaging Logic

This commit is contained in:
deathbybandaid 2019-05-03 11:09:22 -04:00
parent d8e0219814
commit a939d29537

View File

@ -28,24 +28,28 @@ def bot_command_hub(bot, trigger):
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command') triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
if not len(triggerargs): if not len(triggerargs):
bot.say("You must specify a channel.") bot.say("You must specify a channel or nick.")
return return
channel = spicemanip.main(triggerargs, 1) target = spicemanip.main(triggerargs, 1)
if not inlist(bot, channel.lower(), bot.memory['SpiceBot_Channels']['channels'].keys()) and channel != 'all': if (target not in ['allchans', 'allnicks']
bot.osd("Channel name {} not valid.".format(channel)) and not inlist(bot, target.lower(), bot.memory['SpiceBot_Channels']['channels'].keys())
and not inlist(bot, target.lower(), bot.users)):
bot.osd("Channel/nick name {} not valid.".format(target))
return return
triggerargs = spicemanip.main(triggerargs, '2+') triggerargs = spicemanip.main(triggerargs, '2+')
if channel == 'all': if target == 'allchans':
channelsendlist = bot.channels.keys() targetsendlist = bot.channels.keys()
elif target == 'allnicks':
targetsendlist = bot.users
else: else:
channelsendlist = [channel] targetsendlist = [target]
botmessage = spicemanip.main(triggerargs, 0) botmessage = spicemanip.main(triggerargs, 0)
if not botmessage: if not botmessage:
bot.say("You must specify a message to send.") bot.say("You must specify a message to send.")
return return
bot.osd(botmessage, channelsendlist, triggercommand.upper()) bot.osd(botmessage, targetsendlist, triggercommand.upper())