{"id":15195444,"url":"https://github.com/w3gen/telegrambotforastoneshi","last_synced_at":"2026-03-05T03:32:09.329Z","repository":{"id":130811050,"uuid":"412762354","full_name":"w3gen/TelegramBotForAstoneshi","owner":"w3gen","description":"Telegram Bot which can collect messages and store in a database.","archived":false,"fork":false,"pushed_at":"2024-04-14T05:23:19.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T14:16:35.221Z","etag":null,"topics":["api","bot","chatbot","colab-notebook","ipython-notebook","mongodb","natural-language-processing","python","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"https://colab.research.google.com/drive/1ggZkgzdYXiJ4uUY2dmib15Or4tvp9FvR?authuser=1#scrollTo=b6Neolbr3cO7","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/w3gen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-02T10:23:59.000Z","updated_at":"2022-05-05T09:29:04.000Z","dependencies_parsed_at":"2024-09-18T21:03:23.581Z","dependency_job_id":"37a17a00-6265-4d53-9932-c66dae03358c","html_url":"https://github.com/w3gen/TelegramBotForAstoneshi","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3gen%2FTelegramBotForAstoneshi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3gen%2FTelegramBotForAstoneshi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3gen%2FTelegramBotForAstoneshi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3gen%2FTelegramBotForAstoneshi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w3gen","download_url":"https://codeload.github.com/w3gen/TelegramBotForAstoneshi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241445072,"owners_count":19963918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bot","chatbot","colab-notebook","ipython-notebook","mongodb","natural-language-processing","python","telegram","telegram-bot"],"created_at":"2024-09-27T23:23:40.976Z","updated_at":"2026-03-05T03:32:09.288Z","avatar_url":"https://github.com/w3gen.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram Bot\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ggZkgzdYXiJ4uUY2dmib15Or4tvp9FvR?usp=sharing)\n\nYou will find it at https://t.me/messagecollector_bot\n![Diagram](src/Diagram.png)\n\n### Setting up the environment\nTelegram bot is using these python dependencies\n```python\nimport logging\nimport os\nimport telebot\nfrom telegram import ParseMode\nfrom telegram.ext import CallbackContext, Updater, CommandHandler, JobQueue, Dispatcher\nimport pymongo\nimport json\nimport pandas as pd\nimport jsonpickle\n```\nThese environment variable are mandatory to run the bot. You can override them when you run the bot on Google Colab\nor you can setup Heroku configs.\n```python\nBOT_TELEGRAM_API_TOKEN = \"\"\nBOT_MONGODB_CONECTION_URL = \"\"\nBOT_DATABASE_NAME = \"\"\n```\n\n#### Telegram\nThis is a Telegram Bot. It uses Telegram's HTTP API.\n- Bot username on Telegram: ```@messagecollector_bot```\n\n### Initializing the bot on Telegram\nYou can find the bot on Telegram. Initiate a chat or you can add the bot into your groups.\nThen try these sample commands.\n- /about - About this bot\n- /help - Help topics\n\n#### Registering the bot\nBotFather is the parent of all Telegram Bots.This telegram bot is registered via BotFather. (```@messagecollector_bot```) and these parameters have been setup using the BotFather.\n- Name of the bot\n- Description of the bot\n- Profile Picture of the bot\n- Command list\n\n#### Linking the bot with the code\nBot communicates with the backend python code using the bot-token. \nThe bot-token is mandatory to run the bot.\n\n#### Adding the bot into groups\nSearch ```@messagecollector_bot``` and add it into your group. Grant admin permission if you want to manage the group via the bot.\n\n### Testing the Bot\nTo test the bot, use the .ipynb file on a Google Colab environment. Execute each step and run the bot.\nAt the end you can view collected data using python Pandas library.\nUsing python pandas library you can manipulate almost everything on your data.\n\n#### Polling\nTo receive messages, the bot must do polling (continuous triggering the telegram API). \n```python\n# start polling to continuously listen for messages\nbot.polling()\n# gracefully stop the bot after ctrl + c \nbot.stop_polling()\n```\n#### Sending messages into a specific Chat ID\nChat ID is same as the user ID if it's a private chat between the user and the bot. \nIf the bot is inside a group, chat ID is different.\n```python\nbot.send_message(chat_id, txt)\n#Ex: bot.send_message(-1001545752396, \"Hi\") -\u003e 1664758714 is the chat ID (For private messages, group ID = Chat ID)\n```\n## Owner\nThis repository is owned by @astoneshi \n\n## License \nMIT, Not for Commercial purpose\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3gen%2Ftelegrambotforastoneshi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw3gen%2Ftelegrambotforastoneshi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3gen%2Ftelegrambotforastoneshi/lists"}