0
votes

I want to get the Telegram Bout to withdraw an custom information out of Telegram.

when "/invite (xyz)"
  bot.api.send_message(chat_id: message.chat.id, text: "Inviting (xyz)")

the bot should withdraw me the (xyz) to the coustom message. the other think is, how can i let ruby paste me the coustom name into a text file, with an command line "/invite (xyz)" <--- into the text file. so if i do at telegram: /invite Rob

Telegram should write me "Inviting Rob" and print me into the text file "/invite Rob"

Is there any way to take out the custom (xyz) word and read it out and use it in the code?

1
I think you are talking about regular expressions in Ruby. - geekazoid

1 Answers

0
votes

You could do something like

if text_field.start_with? '/invite '
  bot.api.send_message(chat_id: message.chat.id, text: "Inviting #{text_field.sub('/invite ',''}"