BirkhoffLee@tg says to YSITD
Bot = require 'node-telegram-bot' Sandbox = require 'sandbox' bot = new Bot( token: '123:123' ) .on('message', (message) -> console.log "@#{message.from.username}: #{message.text}" if !message.text? bot.sendMessage chat_id: message.chat.id, text: "Sorry #{message.from.first_name}! You have to give me the node.js code(in string) so I can evaluate that for you!" return if message.text.indexOf("/start") == 0 bot.sendMessage chat_id: message.chat.id, text: "Hello #{message.from.first_name}!\nYou can tell me what node.js code I need to evaluate, and I will give you the result." return new Sandbox().run message.text, (output) -> result = if output.console.length > 0 then "Console logs:\n" else "" output.console.forEach (entry) -> result += entry + "\n" result += "\nEvaluate result:\n#{output.result}" bot.sendMessage chat_id: message.chat.id, text: result.trim() ) .start()