How To Create A Telegram Bot In Python For Beginners (2023 Tutorial)

  Рет қаралды 269,776

Indently

Indently

Күн бұрын

In today's video we will be creating a chat bot for Telegram using Bot Father and Python. This is the perfect bot for getting started with creating more complex Telegram bots. It will show you how to get an API Token, how to customise the bot, how you can add commands to the bot, and how you can make it work in groups!
▶ Become job-ready with Python:
www.indently.io
▶ Follow me on Instagram:
/ indentlyreels
00:00 Intro
00:32 Bot Father
01:27 API Token
02:15 Bot Customisation
04:20 Pip Install
04:51 Imports
05:11 Bot Commands
07:09 Handling Responses
09:08 Handling Messages
13:07 Errors
13:37 Putting It Together
16:24 Command Descriptions
18:12 Running The Bot
19:35 Group Chat
21:55 Success!

Пікірлер: 246
@worldofelectronicsandprogr1128
@worldofelectronicsandprogr1128 11 ай бұрын
Awesome tutorial!! ☺☺ I've managed to make my first chat box watching this great and simple video! Many thanks! 👏👏🙏🙏 You are a great tutor and you explain very well the concepts! 👍👍Keep up the good work!!!! ☺☺🙏🙏
@moharrammoharrami3957
@moharrammoharrami3957 Жыл бұрын
Thanks, today was my off day and I randomly found this video. First I made this exactly as you taught, then I changed stuff and learned more about python (I'm a JS developer). Best way for a software developer to spend his off day :)
@strycinek
@strycinek Жыл бұрын
Excellent video man, it was exactly what I need to create my own simple bot
@humadi2001
@humadi2001 10 ай бұрын
I keep coming to your source code several times. Keep it up!
@auroram4936
@auroram4936 2 ай бұрын
thank you so much for this clear, easy to follow tutorial!! you saved my project
@parsahosseini4241
@parsahosseini4241 Күн бұрын
Clear, to the point, no bs, clean code and understandable instructions. This man got himself my respect ❤ Thanks a lot for this quality content mate.
@sen4674
@sen4674 Жыл бұрын
Thanks, I just successfully made my first Telegram bot.
@jonnywoo8418
@jonnywoo8418 Жыл бұрын
Finally Latest version video! Thanks!
@yashchatt5754
@yashchatt5754 23 күн бұрын
Was searching for updated vid! This helps a lot
@chris-mq8rv
@chris-mq8rv 4 ай бұрын
great walkthrough, and explanations along the way. Thanks man.
@qwert4871
@qwert4871 9 ай бұрын
Great tutorial! There's one thing I want to add though. Your implementation of error handler lacks information on a line of the problem. After passing around with GPT-4 for a while I found a solution to get more information: ```python async def error(update: Update, context: ContextTypes.DEFAULT_TYPE): _, _, tb = sys.exc_info() line_number = traceback.extract_tb(tb)[-1][1] exc_type, exc_value, exc_traceback = sys.exc_info() error_traceback = traceback.format_exception(exc_type, exc_value, exc_traceback) print(f"Update {update} caused error {context.error}: {''.join(error_traceback)}") ```
@chaitanyaunavane5819
@chaitanyaunavane5819 Жыл бұрын
thank you for the updated video! very helpful
@xasaninomov1453
@xasaninomov1453 8 ай бұрын
Thank you, very much I am so exited that my bot is actually working
@adityakakade836
@adityakakade836 3 ай бұрын
Thanks brother. It working. Very informative tutorial 👍
@charleshu8041
@charleshu8041 5 ай бұрын
it's amazing I followed your video did the same and it works and running well in my local PC, this my first time learn Python!! thank you so much!!! can you also make another video to show how to deploy these codes to Lambda? One thousand thanks to you🎉❤
@arsalanshafiq9260
@arsalanshafiq9260 Жыл бұрын
Really like your accent and sense of humour
@systemkey1
@systemkey1 2 ай бұрын
very excellent video my brother keep up the good work.
@sifiso89
@sifiso89 7 ай бұрын
BROOOOOOOOOOOOOOOOOOOOOOOO thanks a million 🇿🇦
@YHVB1
@YHVB1 9 ай бұрын
Very informative video, Thank you!
@hicamajig
@hicamajig 10 ай бұрын
Very good overview. Thanks for this!
@nemira_oni590
@nemira_oni590 Жыл бұрын
thanks, just inserted my token and bot name and it works!
@taichinhexpress_official
@taichinhexpress_official 8 ай бұрын
Thank you so much, i learn and make it successfully. 😍😘
@user-wf4ew5gx1q
@user-wf4ew5gx1q 8 ай бұрын
thanks for sharing your knowledge
@mayorc
@mayorc Жыл бұрын
Can you make a video for the updated workflow for telegram bots using login credentials, two factors authentication using OTP, and ConversationHandler using multiple STATES?
@KH-Hi_1XBET1
@KH-Hi_1XBET1 Ай бұрын
Love the video it amazing 😍
@mlindatech
@mlindatech 4 ай бұрын
Great at first this thing did not work but after revisiting my code it worked
@joshitoshi9835
@joshitoshi9835 Жыл бұрын
Thanks for the tut but plz teach us with more details about the api, like why we are using or calling this and that function. Plus how can we restrcit access to some users only? like i want 5 people to use the bot only. Also teach us how to convert any python script to telegram bot. Thanks
@lucasputz4475
@lucasputz4475 Ай бұрын
i love your descriptions like "we'll need a command handler that is handling the commands". you could have just published your code with explanations like that
@Indently
@Indently Ай бұрын
I make myself laugh sometimes
@khoreugene3060
@khoreugene3060 Жыл бұрын
Hi, i love you videos, can you do one that integrate sending photos from certain url once you do a command? and also do one video with inlinekeyboard?
@SlLakshan
@SlLakshan Жыл бұрын
Great video. Thank you.
@user-ot5bq2gk8l
@user-ot5bq2gk8l 10 ай бұрын
thanks for you,you are greate developer.
@gulnarahuseynova1718
@gulnarahuseynova1718 5 ай бұрын
Thank you so much!
@user-lv7ft2zu7k
@user-lv7ft2zu7k 9 ай бұрын
Nicely done.
@arsalanshafiq9260
@arsalanshafiq9260 Жыл бұрын
Great well done
@Juan-wg4gy
@Juan-wg4gy Жыл бұрын
Hi, how are you?. When I run all the telegram libraries, such as: Filters, it returns me that it is not compatible with version 3.11 of python. But from what I see you are using 3.11, what could be the reason that throws me that error?
@MichaelBomett
@MichaelBomett Жыл бұрын
Thanks for the video, how do i add the script to a django project so it runs alongside and uses context from django model to respond back? Any pointers?
@domontowicz
@domontowicz Жыл бұрын
Hi! Thanks for the tutorial! Could you make a video about how to create a bot grabbing messages by keywords from different telegram private channels and sending to our private channel?
@Gautam1108
@Gautam1108 11 ай бұрын
I was kind of curious to ask: if I create this bot - will i be able to access data of a website through it's API key? I want to perform an analysis of the data.
@mhamadnazm7588
@mhamadnazm7588 5 ай бұрын
Great tutorial
@-nu6co
@-nu6co 21 күн бұрын
Well explained
@jacksonjiang6313
@jacksonjiang6313 9 ай бұрын
Thank you for your very clear explanation. But I am wondering how to purely send a message instead of replying? Coz I don't think it should be added into add_handler. Could you help me to solve that?
@ramsidharth2931
@ramsidharth2931 3 ай бұрын
Finally got a legitimate code that would work !
@systemkey1
@systemkey1 2 ай бұрын
thank you SO much.!!
@emanuelalbuquerque9032
@emanuelalbuquerque9032 10 ай бұрын
Keep up this magnificent work that helps many people who work or want to work with technology. A hug directly from Brazil.
@bhai431
@bhai431 3 ай бұрын
*What is PYTHON SCRYT? How to get that* ?
@MrValVet
@MrValVet 3 ай бұрын
Thank you!
@John-om5dm
@John-om5dm 7 ай бұрын
Legend!
@adeola1183
@adeola1183 Жыл бұрын
Great video. How would I make one command randomly generate a predefined number of responses?
@borismaiorov2703
@borismaiorov2703 Жыл бұрын
Hi! Thank you very much! Got it all done, no errors, but when i running the script i getting "Process finished with exit code 0"
@appalachhiahuesllc.231
@appalachhiahuesllc.231 9 ай бұрын
Do you do custom bot builds? I am definitely not this savvy with computers!
@telmuungan-ulzii8333
@telmuungan-ulzii8333 9 ай бұрын
What program are you using for coding?
@sherminatorhd318
@sherminatorhd318 10 ай бұрын
hey man great video, any idea on any platform recommended to run the bot?
@ilkhomjonabdurakhimov8158
@ilkhomjonabdurakhimov8158 11 ай бұрын
To create this telegram bot We should use Pycharm Ultimate or it is possible create it by Community version of program?
@Zynnel
@Zynnel 10 ай бұрын
Thank you so much this worked perfectly, i just have a question, how can I add emojis to the bot responses?
@alexandrkardash6594
@alexandrkardash6594 Ай бұрын
Thank you for tutorial. Just wonder if you familiar with telegram payments platform? Hopefully you'll find this topic interesting and create amazing short tutorial for that. Thanks you for your work
@user-os1hv1lm3l
@user-os1hv1lm3l 3 ай бұрын
Hello, you are great, I like your teaching very much. Why didn't you post more video for telegram bot in python?
@user-sc1sm3em9w
@user-sc1sm3em9w 4 ай бұрын
cool video)
@deep_singh01
@deep_singh01 4 ай бұрын
Superb Video 🤟🤟 But Can you please help in building chatbot that answer any question or query automatically in this manner?
@worldofelectronicsandprogr1128
@worldofelectronicsandprogr1128 11 ай бұрын
Can you make a video on creating automated welcome messages to new members in a Telegram group? It would be extremely useful! Thanks! ☺☺🙏🙏
@nabil.hamawi
@nabil.hamawi Жыл бұрын
Thanks!
@hazza6208
@hazza6208 4 ай бұрын
It worked for me. Thank you for the wonderful content. I hope you can explain to us how to put all the languages in artificial intelligence
@2mat012
@2mat012 4 ай бұрын
can you share the code
@lemon-lu3gv
@lemon-lu3gv 5 ай бұрын
thanks for your video!!!!!!
@Alexos92
@Alexos92 5 ай бұрын
Amazing video, really great way to get started on a bot project :) You cast all your variables into a type. This is not very common in python no ? Will the code work without it ? Thanks for your work !!
@whistleblower66
@whistleblower66 5 ай бұрын
Yes, it will work but I find it's a good practice, in general.
@henrynph
@henrynph 7 ай бұрын
i have a question , i follow your tutoral to coding ,the python can run smothly but the bot can't respont my command which part aer gose wrong? also i sen the message when the code run the python out respont the message i send said channel_chat_created=False
@liam-gc9zt
@liam-gc9zt 3 ай бұрын
line 24, how would I put that right pointing arrow on linux with nano?
@bakousystems3888
@bakousystems3888 7 ай бұрын
thank you! very helpful. in grouptype show "supergroup" from console
@sontoviet6374
@sontoviet6374 7 ай бұрын
Hi Admin. How can i do to response user only by one fix message and do not run any command when recever message mode private. Because i only want my bot respond in group. Pls help me
@zewelry
@zewelry Жыл бұрын
thank you. one question,i want run other thing when polling. how to do that.
@thelostman5625
@thelostman5625 Жыл бұрын
Hi! Can we make bot having menu subscribe and when user choose subscribe, the /subscribe menu become /unsubscribe only for the user?
@abdulwahidali493
@abdulwahidali493 3 ай бұрын
thank you
@Misael62.
@Misael62. Жыл бұрын
the terminal tell me this. when i write (pip install python-telegram-bot) command not found: pip What can i do???
@nikhiljoshi-hk9zu
@nikhiljoshi-hk9zu 3 ай бұрын
as the bot developer do you have access of the material I sent to the bot, or can the bot spread the material I have sent to it ....pls tell
@superOify
@superOify 6 ай бұрын
is there a way to deny other people to communicate with my bot ? I tried to create a group with only me and the bot and after that disable /setjoingroups and /setprivacy 'ENABLE', but iam still able, and so is everyone else to write to it
@bhai431
@bhai431 3 ай бұрын
4:59 how to open this window, *PLEASE SOMEONE HELP*
@alireza.m
@alireza.m 2 ай бұрын
tnx
@user-mq1kb4dc3z
@user-mq1kb4dc3z 6 ай бұрын
Man,you're cool!
@user-sx1uc2sv8c
@user-sx1uc2sv8c 2 ай бұрын
Would this still work using elif statements rather than if statements?
@CryptoSaNjAY1
@CryptoSaNjAY1 4 ай бұрын
How to Create a bot without joining the source group it will forward messages to the designation group is it possible?
@bikrantjajware6062
@bikrantjajware6062 8 ай бұрын
How do we add users to a group chat if i have usernames/ user_ids
@richardogundele6437
@richardogundele6437 11 ай бұрын
this is the error i am getting in running the code ImportError: cannot import name 'Update' from partially initialized module 'telegram' (most likely due to a circular import)
@touhami_dz6458
@touhami_dz6458 3 ай бұрын
what wallpaper are you using on ur desktop ? i like it
@zvim4664
@zvim4664 11 ай бұрын
Can somebody help me when i type % pip install python-telegram-bot in terminal i get this: You cannot call a method on a null-valued expression. Im stuck here for an hour cant find a solution help
@v3ng4r65
@v3ng4r65 7 ай бұрын
You have to get PATH in Windows for Phyton
@mubinabegimbaxtiyorova6915
@mubinabegimbaxtiyorova6915 9 ай бұрын
Hi How can i create bot that works after you join channels?
@brianngoh4461
@brianngoh4461 10 ай бұрын
hi i've been getting this error and I cant really find anything on google AttributeError: 'ApplicationBuilder' object has no attribute 'add_handler'
@farshadpanahi4384
@farshadpanahi4384 Жыл бұрын
خیلی هم خوب. ادامه بده.
@xasaninomov1453
@xasaninomov1453 8 ай бұрын
help me a have some kind wierd situstion it says 'import 'telegram' not found'
@user-sp5km5hd4s
@user-sp5km5hd4s 5 ай бұрын
Did u paste the token on visual code studio or node.js
@scotter
@scotter 6 ай бұрын
Thanks for this! I got it working the first time. THANK YOU! Wondering if you can help with one issue: In supergroups it responds to everyone. I tried merely adding "or 'supergroup' in ..." but that didn't work. Also, issues getting user id or username. Telegram's page on their API is either old or just difficult for me to figure out. Any help welcome!
@abhinavsingh4176
@abhinavsingh4176 5 ай бұрын
Same issue
@SemiColonCoder
@SemiColonCoder 11 ай бұрын
Hi How to make a video response or a file response other than string?
@parsahosseini4241
@parsahosseini4241 Күн бұрын
If you couldn't recieve any messages in your python side, in my case the problem was the `filters.Text` part, instead of passing it without calling it, I call it with no parameters like this: `filters.Text()`.
@abbosbekpirnazarov
@abbosbekpirnazarov Ай бұрын
Hi guys I have a poblem with this | 14:32 | (custom_command) What should I do ?
@chrisberry6575
@chrisberry6575 7 ай бұрын
How to return files as a response?
@story4adults
@story4adults 5 ай бұрын
thanks bro :)
@Indently
@Indently 5 ай бұрын
No problem
@kiinloxpage7863
@kiinloxpage7863 Ай бұрын
i use VSC and i do not know where is local so, how to open local pl help
@user-nd5pw2ux6k
@user-nd5pw2ux6k 8 ай бұрын
hi! i have this error when i sent 'how are you' to my telebot and it doesn't give me any response as it should written in the code: case error check_update() missing 1 required positional argument: 'update' but i don't see any check_update() in the code, so i assume is probably because of the library, can someone explain to me the error and how i can debug this error?
@seyftech2780
@seyftech2780 3 ай бұрын
I also face this error. how can I solve it. please?
@walidmat8972
@walidmat8972 10 ай бұрын
pleas how can i make the bot respond with a video like a tutorial to use the bot ? and how to host the bot on aserver ? thnx
@sanaallahkheiri88
@sanaallahkheiri88 4 ай бұрын
Hi sir Thanks for this masterpiece tutorial I had issues with installing pytel package I opened the terminal tuyped the exact command but it gave me this error: No Python at 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe'
@jamesacquaye8054
@jamesacquaye8054 Жыл бұрын
Hi please how do I get the pip install command using pycharm
@sudharsandas5779
@sudharsandas5779 10 ай бұрын
Is the explicit typing necessary in Python? Why is he doing this?
@viralquotes1105
@viralquotes1105 Жыл бұрын
Hello! The bot was completed and run successfully but not respond in telegram any help please
@teenu3670
@teenu3670 Жыл бұрын
this bot is replying to anyone if the user is not even mentioning the bot in group how to fix
FOUND MONEY 😱 #shorts
00:31
dednahype
Рет қаралды 7 МЛН
Don't eat centipede 🪱😂
00:19
Nadir Sailov
Рет қаралды 21 МЛН
О, сосисочки! (Или корейская уличная еда?)
00:32
Кушать Хочу
Рет қаралды 6 МЛН
The most important Python script I ever wrote
19:58
John Watson Rooney
Рет қаралды 66 М.
Create A Python API in 12 Minutes
12:05
Tech With Tim
Рет қаралды 530 М.
Telegram Birthday Bot in Python - Never Forget One Again
33:58
NeuralNine
Рет қаралды 11 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
Python Telegram Bot Creation: Easy Tutorial for Beginners
18:21
AI Programming Zone
Рет қаралды 927
Create a Python GPT Chatbot - In Under 4 Minutes
3:56
Tech With Tim
Рет қаралды 129 М.