Added YAML config and basic response abilities

pull/1/head
Aaron Johnson 7 years ago
parent 910ebf2182
commit b78a950dda

2
.gitignore vendored

@ -0,0 +1,2 @@
/bot_config.yaml

@ -0,0 +1,2 @@
token: '<your-bot-token>'

@ -0,0 +1,34 @@
#!/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."
puts "Sending #{reply.inspect}"
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
when '/srv-start'
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 '/srv-stop'
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
Loading…
Cancel
Save