DEV Community

Making Telegram Bots with Python

Gurkirat Singh on April 14, 2020

Course Outline Prerequisite Knowledge and Requirements Basic python knowledge Telegram Account About Course In this course, you wi...
Collapse
 
rio_albert profile image
Albert Rio

Your curiosity about making Telegram bots with Python takes me back to a whimsical weekend last year. I had invited a few buddies over for a board game night at my place. But as tech enthusiasts, we often get sidetracked. Instead of playing the actual board games, we ended up conceptualizing a fun project: to build a Telegram bot for our gaming group that would notify everyone about the upcoming gaming events and keep scores. Now, we weren’t prepared for this on-the-spot coding marathon, and none of us was a real Python guru. So, we decided to hire a python expert from Digitalogy.co to help us out.

The expert was named Tim, a friendly guy with a penchant for coffee and humorous Python anecdotes. Together, with his help, we spent the night integrating functionalities into our bot using Python's 'python-telegram-bot' library. It's a fantastic tool that abstracts away the intricacies and lets you focus on building features. For instance, we added a function where users could "challenge" others in the group for a game, and the bot would automatically set up a poll for members to vote on the date and time. By dawn, not only had we built a functional bot, but we had also had heaps of fun (and quite a few coffee cups piled up!). It's incredible how much you can achieve with Python and a dash of creativity.

Keep exploring, and if you ever want to deep dive into making your own Telegram bot, remember that there's always a vast Python community out there willing to help, whether you're just starting or looking to refine your expertise!

Collapse
 
xiaoyao_1992 profile image
xiaoyao

good

Collapse
 
zahidcodes profile image
Iftikhar Zahid

superb bro. so hardworking......

Collapse
 
sectasy0 profile image
sectasy

Hi, Great Tutorial!! If you want to internationalize your bots then you can check out my library to internationalize python projects, Thanks!

github.com/sectasy0/pyi18n

Collapse
 
pallavi38408805 profile image
Pallavi

This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
Python classes in pune

Collapse
 
tbhaxor profile image
Gurkirat Singh

Thank you, pallavi

Collapse
 
kedarkhedkar profile image
Kedar Khedkar

Hey, can you help me with the storing users input in conversation

Collapse
 
tbhaxor profile image
Gurkirat Singh

Sure. Where are you stuck?

Collapse
 
kedarkhedkar profile image
Kedar Khedkar

Can we have a discussion on mail, I want to learn some more things about the Python Telegram Bot

Thread Thread
 
tbhaxor profile image
Gurkirat Singh • Edited

Sure. Send me your question on [READACTED]

Thread Thread
 
kedarkhedkar profile image
Kedar Khedkar

I solved the problem, but surely ask you in future if I am stuck. Your article really helped me to understand the library. Thanks for that!

Collapse
 
sod profile image
Sodiq Ojulari

Great tutorial, thanks for taking the time to work on this. The project links in your post is broken.

"All the snippets and projects related to this course will be found in projects directory"

I appreciate your content.

Collapse
 
alvindera97 profile image
Nwokolo Godwin Chidera

I honestly don't know why the devs at Telegram don't have something as amazing as this!!! This is one of my best reads in 2021! A masterpiece!!!!

Thanks!

Collapse
 
tbhaxor profile image
Gurkirat Singh

Glad to know you liked it

Collapse
 
bizzyel profile image
BizzyEL

How can I add an emoji to the replyKeyboardMarkup text string?

Collapse
 
tbhaxor profile image
Gurkirat Singh

You can straightaway use emojis in the strings. It does support unicode characters.
For more details, please read this wiki → github.com/python-telegram-bot/pyt...

Collapse
 
jdanvz profile image
Daniel Vázquez

The Github repo are down

Collapse
 
sectasy0 profile image
sectasy

Great tutorial! Maybe you will be interested in internationalizing your bots with my library. I would be grateful for checking and leaving a trace

Collapse
 
mlazzarotto profile image
mlazzarotto

Can I use python-telegram-bot inside a class?

I would like to create a TgBot class and create the bot inside this class

Collapse
 
tbhaxor profile image
Gurkirat Singh

Yes, you can use these call back functions in the class as well. All you have to do is use self.methodName and in class it should have def methodName(self, update, context)

Collapse
 
arkadeepnag profile image
Arkadeep Nag

Hey devs check my latest post , may help you in python dev.to/arkadeepnag/creating-a-gui-...

Collapse
 
thiruxd profile image
ThiruXD ♡︎

hey, explain about pyrogram formwork