{"id":20149558,"url":"https://github.com/lonami/dumbot","last_synced_at":"2025-04-09T20:11:08.195Z","repository":{"id":43025182,"uuid":"130477543","full_name":"Lonami/dumbot","owner":"Lonami","description":"dumb telegram bot for python.","archived":false,"fork":false,"pushed_at":"2023-10-10T17:44:42.000Z","size":49,"stargazers_count":34,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T20:10:58.741Z","etag":null,"topics":["api","bot","dumb","python","telegram"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Lonami.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}},"created_at":"2018-04-21T13:43:14.000Z","updated_at":"2024-12-28T02:18:44.000Z","dependencies_parsed_at":"2023-01-18T14:16:40.955Z","dependency_job_id":null,"html_url":"https://github.com/Lonami/dumbot","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lonami%2Fdumbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lonami%2Fdumbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lonami%2Fdumbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lonami%2Fdumbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lonami","download_url":"https://codeload.github.com/Lonami/dumbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"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","dumb","python","telegram"],"created_at":"2024-11-13T22:46:02.482Z","updated_at":"2025-04-09T20:11:08.150Z","avatar_url":"https://github.com/Lonami.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dumbot\n\ndumb async telegram bot for python 3.\n\n# installation\n\nadd `dumbot.py` to your project or `pip install dumbot`.\n\n# usage\n\n## basic\n\n```python\nimport asyncio\nfrom dumbot import Bot\n\nasync def main():\n    bot = Bot(token)\n    print(await bot.getMe())\n    msg = await bot.sendMessage(chat_id=10885151, text='hi lonami')\n    if msg.ok:\n        print('message sent', msg)\n    else:\n        print('something went wrong!', msg)\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n```\n\n## files\n\n```python\n\nasync def main():\n    ...\n    await bot.sendDocument(chat_id=10885151, file=dict(\n        type='document',\n        file='/home/lonami/holiday.jpg'\n    ))\n```\n\n## updates\n\n```python\nasync def on_update(update):\n    await bot.sendMessage(\n        chat_id=update.message.chat.id,\n        text=update.message.text[::-1]\n    )\n\n...\nbot.on_update = on_update\nbot.run()\n```\n\n## subclassing\n\n```python\nclass Subbot(Bot):\n    async def init(self):\n        self.me = await self.getMe()\n\n    async def on_update(self, update):\n        await self.sendMessage(\n            chat_id=update.message.chat.id,\n            text='i am {}'.format(self.me.username)\n        )\n\nSubbot(token).run()\n```\n\n# faq\n\n## what methods are available?\n\nhttps://core.telegram.org/bots/api.\n\n## can i send opened files or bytes directly?\n\nyes.\n\n## can i change a document's filename or mime?\n\nyes, with `name` or `mime` fields in the `dict`.\n\n## how can i handle exceptions?\n\nthere aren't, simply check the `.ok` property.\n\n## what's the return value?\n\na magic object, accessing unknown properties returns a false-y magic object:\n\n```python\nfrom dumbot import Obj\n\nlonami = Obj(name='lonami', hobby='developer')\nprint(lonami.name, 'is', lonami.age or 20)\n\nlonami.friend.name = 'kate'\nprint(lonami.friend)\n```\n\n## no dependencies?\n\npython alone is enough dependencies.\n\n## how does this work without urllib or aiohttp?\n\nit's simple, we construct http requests manually.\n\n## why would you reimplement http?\n\nit's a fun good learning experience, and avoids bloat dependencies.\n\n## what do you have against uppercase?\n\nscary. there would be less upper case if it weren't for\npython's naming conventions or telegram's for that matter.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonami%2Fdumbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flonami%2Fdumbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonami%2Fdumbot/lists"}