Sloganın burada duracak

How To Create Telegram Bot?

As you know, Telegram is one of the most popular platforms between the people.

The people use this platform for their business and earn money.

Maybe, some of the people who are beginner with the Telegram, create a Telegram bot is a complex job.

In this article, we describe the steps for create a Telegram bot.

Telegram bot can be use with the intercom API.

It can support the agent to search and reach the customers who use the Telegram.

Telegram bot also has automations motors that you can do in to the live chat.

In following, you can see the easiest ways to create a bot.

We will also learn you how to add bot to Telegram group and channels easily.

1- Download And Install The Telegram Application

Every person installed this program on their mobile phone, if you can use it for the great purpose.

It a good idea that install it on your computer.

After that you download and install the telegram, you should copy and paste the telegram bot API key in your text editor.

2- Chat With Bot Father To Get The API Key

If you want to get the API key, you should speak with the bot father.

Bot creation is like as novel process because all of your interaction in Telegram through the Telegram bot.

You should search the username of bots in search box and start conversion with him.

This bot is a bot father. For start the conversation, you should send the start to bot father.

After that, you see a lot of list that you can edit, manage or create your bots.

You should want the new bots. If we want to compare a create Telegram bot by twitter bot or mastodon bot.

We can say that the Telegram bot steps are really easy and simple.

After that you want the new bot, you should choose a name and username for him. Your bots name.

means that your users or members see his name of their contact and username means that your users can find your bot with it.

Remember that, your bot username should be short and unique.

If the users can be memorable it, they can search it easily.

For buy Telegram members just check out our shop.

After you done all of things, you can get the API key.

The API key cause that the Telegram knows the codes that you enter for your bot.

Remember, you don’t send or share your API key to any one and its just for your bots.

Setting Your Telegram Bot

Setting Your Telegram Bot

3- Setting Your Bots Gem And Directory

For this job, you should go to the MKDIR Telegram bot.

This part causes that a new directory creates for your bot files.

You should limit it on another files.

If you want to go to the directory, you should use cd Telegram bot.

Ffter you do this, you should do as we describe in following:

Touch gem file

Touch bot. rb

atom

after that, you see a two blank files.

One of them is for setting up gems and another one is for bot code that should be live in it. the atom is placed in side bar.

You should click on the gem file and paste the following phrase in it:

source ‘https://rubygems.org’

gem ‘Telegram_bot’

after that you complete the gems in Telegram, you go back and type the bundle.

The setting up the gems for create a Telegram bot is complete and now you should get the code.

Coding Telegram Bot

It must be said that, the real code that the telegram bot should be running with it is inside the “bot. rb”.

In this time, if you go to the “bot. rb”, you see that its empty but you should link in the Telegram gem to create a bot.

After that, you should write the following phrase:

require ‘Telegram_bot’

token = ‘TOKEN’

bot = TelegramBot.new(token: token)

the next step seems that is very complex, but when you do this by our approach, is become very easy and simple.

bot.get_updates(fail_silently: true) do |message|

puts “@#{message.from.username}: #{message.text}”

command = message.get_command_for(bot)

message.reply do |reply|

case command

when /start/i

reply.text = “All I can do is say hello. Try the /greet command.”

when /greet/i

reply.text = “Hello, #{message.from.first_name}. “

else

reply.text = “I have no idea what #{command.inspect} means.”

end

puts “sending #{reply.text.inspect} to @#{message.from.username}”

reply.send_with(bot)

end

end

the first line of above column means that bots are ready to listening to your commends.

Telegram bot response usually stored in the case statement.

After this step, you can find your bot and send the start or great command to your him.

You should save the changes in atom and run the ruby robot.

When your terminal open and running, your bot send a lot of response and add bot to Telegram messenger.

Customize Telegram Bot

Customize Telegram Bot

Customize Your Bot

After that you done all of the steps for create Telegram bots, maybe seems very fine but you should try to make it interesting.

You should pay attention to when/command/I for customizing a bot and also the text on the reply.txt.

If you want to make a change in response to the /greet command, you should change the reply.txt.

In following we show you a variation that you can try it in your reply.txt.

when /greet/i

greetings = [‘bonjour’, ‘hola’, ‘hallo’, ‘sveiki’, ‘namaste’, ‘salaam’, ‘szia’, ‘halo’, ‘ciao’]

reply.text = “#{greetings.sample.capitalize}, #{message.from.first_name}!”

it must be said that we show another way that you can use it for create a Telegram bot.

Telegram bots can help you in you business and also can increase your channel or group members.

Another way for create a Telegram bot, at first you should search the @bot father in the search box.

Go To The “Bot Father” And Send /Start

If you send a new bot to the bot father, it means that you want to create a Telegram bot.

Next step, you should select a name for your bot.

Don’t forget, for choosing name for the bot, you must add a bot at the end of the name.

If the name that you choose is repetitive, you should change it.

Now you have one bot in Telegram, but you should copy its token.

Search a @controller bot in the search box.

Do you want free Telegram members unlimited? check related page now.

Go to this page and send a start option, after that send a add channel to @ controller bot.

It must be said that, your new bot that created in your Telegram, activate like as admin for your Telegram channel.

When you have done all this, you should go to your bio and copy the channel link and now you should paste it in the @ controller bot page. suggest article: add member to Telegram bot

 
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol