You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
empyrion-bot/empyrion-bot.rb

36 lines
1.3 KiB

#!/usr/bin/env ruby
require 'rubygems'
require 'yaml'
require 'telegram/bot'
conf = YAML.load(File.read("bot_config.yaml"))
token = conf['token']
puts 'Bot token: ' + token
Telegram::Bot::Client.run(token) do |bot|
bot.listen do |message|
case message.text
when '/start'
reply = "This bot will eventually (hopefully) be able retrieve information and pass start/stop commands from/to an Empyrion server, to make life easier for meatbags like you.\n\n" +
"Commands available:\n/start\n/srvstart\n/srvstop\n/status"
puts "Sending #{reply.inspect}"
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
when '/srvstart'
reply = "UNAVAILABLE: This command would start the game server if the code were there."
puts "Sending #{reply.inspect}"
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
when '/srvstop'
reply = "UNAVAILABLE: This command would stop the game server if the code were there."
puts "Sending #{reply.inspect}"
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
when '/status'
reply = "UNAVAILABLE: This command would provide server status and possibly version... If the code were there."
puts "Sending #{reply.inspect}"
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
end
end
end