function on_msg_receive (msg) if msg.out then return end if ((msg.text=='/purple') or (msg.text=='/p')) then local file = io.open("/home/pi/git/lights/tglog.txt", "w") local timestr = os.date("%Y/%m/%d-%H:%M:%S") local message = ("purple|" .. timestr .. "|") send_msg (msg.from.print_name, message, ok_cb, false) file:write("purple|", timestr, "\n") file:close() end end function on_our_id (id) end function on_secret_chat_created (peer) end function on_user_update (user) end function on_chat_update (user) end function on_get_difference_end () end function on_binlog_replay_end () end