r/learnpython • u/Lyaw_Lyawa • 3d ago
Do you know any Python library to build bots?
I mean, any sort of bot, it's not for a specific porpuse, I'm just interested and want to learn about it.
0
Upvotes
10
u/patryk_builds 3d ago
Bot covers a few different things, and each has its own library:
- Chat bots: discord.py for discord, python-telegram-bot for telegram. best place to start, because you see results in minutes and the docs are good
- Reddit bots: praw
- Web automation, clicking through sites like a person would: playwright (selenium is the older option)
- Scraping, just reading pages: requests + beautifulsoup
- Scheduled scripts that do something every hour: plain python plus the schedule library, or cron
If you only want to learn, i'd pick telegram. you get a token from their botfather in about a minute, there's no server to set up, and a bot that replies to a message is around fifteen lines. from there you can add commands, then store something in a file, then call some api, and each step teaches a new thing. One tip before you start: keep the token out of your code. put it in an environment variable or a .env file, and never paste it in a public repo. bots get hijacked that way all the time
2
u/skfin96 3d ago
Try Google, especially if you're going to ask a vague question like that. There are python libraries for many kinds of bots.
2
u/Boothiepro 3d ago
discord.py and its many derivatives like nextcord that i grew quite fond of, got a few projects with them
2
u/Ender_Locke 3d ago
“any bot” you’re gonna need more specifics cuz there’s so many different types , decide what you like / want to work on and then use some of the recs
1
u/jimmyy360 2d ago
Ask ChatGPT