Add admin room restriction

This commit is contained in:
rnhmjoj 2015-06-23 01:34:09 +02:00
parent 061035d2af
commit 30ae194420

View File

@ -76,14 +76,18 @@ module.exports = (robot) ->
res.send (res.random intro) + ':\n' + (list.map (i) -> '* '+i).join '\n'
robot.respond /(mi )?invit(i|ami) (in|nel gruppo) (.+)\??/, (res) ->
nope = ['dove?', 'mai sentito questo?', 'invita anche me magari']
ok = ['provvedo', 'ok', 'certo', 'va bene']
done = ['fatto', 'ecco qui', 'ecco']
denied = ['BZBZ ADMIN-NOT-DETECTED', 'BZBZ IS-NOT-AUTHORIZED', 'BZBZ ACCESS-DENIED']
nope = ['ahahah NO', 'mai sentito questo?', 'invita anche me magari']
ok = ['provvedo subito', 'ok', 'certo', 'va bene']
done = ['fatto', 'ecco qui', 'ecco']
group_list (list) ->
chat = res.match[4]
if not chat in list
res.send res.random nope
return
if chat is process.env['ADMIN_ROOM_NAME']
res.send res.random denied
return
res.send res.random ok
run_command "chat_add_user #{chat} #{res.message.user.name}"
res.send res.random done