https://github.com/antirez/botlib Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} antirez / botlib Public * Notifications * Fork 9 * Star 251 C Telegram bot framework License BSD-3-Clause license 251 stars 9 forks Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights antirez/botlib This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/a] Use Git or checkout with SVN using the web URL. [gh repo clone antire] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @antirez antirez Files download API. ... ca2f977 Nov 23, 2023 Files download API. ca2f977 Git stats * 18 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .gitignore First try at making my bots code a library. November 19, 2023 18:23 COPYING First try at making my bots code a library. November 19, 2023 18:23 Makefile Better example. November 19, 2023 19:53 README.md Warn about API work in progress. November 21, 2023 11:37 botlib.c Files download API. November 23, 2023 22:25 botlib.h Files download API. November 23, 2023 22:25 cJSON.c First try at making my bots code a library. November 19, 2023 18:23 cJSON.h First try at making my bots code a library. November 19, 2023 18:23 json_wrap.c First try at making my bots code a library. November 19, 2023 18:23 mybot.c Files download API. November 23, 2023 22:25 sds.c First try at making my bots code a library. November 19, 2023 18:23 sds.h First try at making my bots code a library. November 19, 2023 18:23 sdsalloc.h First try at making my bots code a library. November 19, 2023 18:23 sqlite_wrap.c Pass dbhandle around. November 20, 2023 16:23 sqlite_wrap.h Add missing stdint include in sqlite wrapper header. November 20, 2023 17:57 xmalloc.h First try at making my bots code a library. November 19, 2023 18:23 View code BOTLIB - Telegram C bot framework Installation APIs README.md BOTLIB - Telegram C bot framework WARNING: API is work in progress. Don't consider it reliable until this message is removed. Installation 1. Create your bot using the Telegram @BotFather. 2. After obtaining your bot API key, store it into a file called apikey.txt inside the bot working directory. Alternatively you can use the --apikey command line argument to provide your Telegram API key. 3. Optionally edit mybot.c to personalized the bot. 4. Build the bot: you need libcurl and libsqlite installed. Just type make. 5. Run with ./mybot. There is also a debug mode if you run it using the --debug option (add --debug multiple times for even more verbose messages). For a more moderate output use --verbose. Try mybot --help for the full list of command line options. 6. Add the bot to your Telegram channel. 7. IMPORTANT: The bot must be an administrator of the channel in order to read all the messages that are sent in such channel. Private messages will work regardless. By default the bot will create an SQLite database in the working directory. If you want to specify another path for your SQLite db, use the --dbfile command line option. APIs ... Work in progress ... For the bot API check mybot.c example itself. The basic usage is pretty simple. However for all the other stuff, like the Sqlite3 abstractions, they are taken from Stonky, so the code there (which is very accessible) will provide some help. I hope to document this project better. For now my main goal was to stop duplicating Stonly to create new bots with all the common code inside. About C Telegram bot framework Resources Readme License BSD-3-Clause license Activity Stars 251 stars Watchers 5 watching Forks 9 forks Report repository Releases No releases published Packages 0 No packages published Languages * C 99.8% * Makefile 0.2% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.