|
|
|
@ -64,6 +64,22 @@ puts "Bot token: #{token}\n\n\n\n"
|
|
|
|
|
#end
|
|
|
|
|
|
|
|
|
|
def handle_message(message)
|
|
|
|
|
if ! message.reply_to_message.nil? then
|
|
|
|
|
#drop message. Someone's replying to a message
|
|
|
|
|
#sent by our bot
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if message.text.nil?
|
|
|
|
|
# Find out if user(s) joined the group. If so, welcome them
|
|
|
|
|
#if ! message.new_chat_members.nil?
|
|
|
|
|
# handle_user_join(message)
|
|
|
|
|
#else
|
|
|
|
|
# #Handle non-messages and non-joins here
|
|
|
|
|
#end
|
|
|
|
|
return #so that we don't try to process this as a command (below)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#Format sender name
|
|
|
|
|
if ! message.from.username.nil?
|
|
|
|
|
message.from.username = "@" + message.from.username
|
|
|
|
@ -150,7 +166,7 @@ Telegram::Bot::Client.run(token) do |bot|
|
|
|
|
|
reply = handle_message(message)
|
|
|
|
|
if reply == "dance" || reply == "flex"
|
|
|
|
|
bot.api.sendVideo(chat_id: message.chat.id, video: "https://img.skyfalltech.net/togra/#{reply}.gif")
|
|
|
|
|
else
|
|
|
|
|
elsif ! message.text.nil?
|
|
|
|
|
bot.api.send_message(chat_id: message.chat.id, text: "#{reply}")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|