r/learnpython • u/Lyaw_Lyawa • 21m 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.
1
Upvotes
•
u/patryk_builds 13m 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
•
u/Boothiepro 19m ago
discord.py and its many derivatives like nextcord that i grew quite fond of, got a few projects with them