{"id":21671426,"url":"https://github.com/harrislapiroff/python-chatbot","last_synced_at":"2025-06-14T05:35:19.261Z","repository":{"id":4435554,"uuid":"5573733","full_name":"harrislapiroff/python-chatbot","owner":"harrislapiroff","description":"A simple, extensible, python-powered IRC bot.","archived":false,"fork":false,"pushed_at":"2019-04-15T03:57:00.000Z","size":19,"stargazers_count":20,"open_issues_count":4,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T22:36:35.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harrislapiroff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-27T16:31:04.000Z","updated_at":"2024-12-28T04:01:57.000Z","dependencies_parsed_at":"2022-09-17T21:43:44.493Z","dependency_job_id":null,"html_url":"https://github.com/harrislapiroff/python-chatbot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrislapiroff%2Fpython-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrislapiroff%2Fpython-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrislapiroff%2Fpython-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrislapiroff%2Fpython-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harrislapiroff","download_url":"https://codeload.github.com/harrislapiroff/python-chatbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248509817,"owners_count":21116124,"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":[],"created_at":"2024-11-25T12:42:50.887Z","updated_at":"2025-04-12T02:53:28.436Z","avatar_url":"https://github.com/harrislapiroff.png","language":"Python","readme":"Python Chatbot\n==============\n\nA simple, extensible bot for your IRC channels.\n\nInstallation\n------------\n\nWith Pip:\n\n```bash\nsudo pip install git+https://github.com/harrislapiroff/python-chatbot.git@master#egg=chatbot\n```\n\nUsage\n-----\n\nTo run a bot, you must write a short python script. For example `simple_bot.py`:\n\n```python\nfrom chatbot.bots import Bot\nfrom chatbot.contrib import *\n\nbot = Bot(\n\tnickname = 'bestbot',\n\thostname = 'chat.freenode.net',\n\tport = 6665,\n\tserver_password = 'my_bots_password',\n\tchannels = ('#freenode', '#python'),\n\tfeatures = (\n\t\tPyPIFeature(),\n\t\tWikipediaFeature(),\n\t\tDictionaryFeature(),\n\t\tDiceFeature(),\n\t\tChoiceFeature(),\n\t\tSlapbackFeature(),\n\t)\n)\n\nbot.run()\n```\n\nThen run the script:\n\n```bash\npython simple_bot.py\n```\n\nThe Flexible `Match` Feature\n----------------------------\n\n**Chatbot** comes with a built in `Match` feature, which is both simple and\npowerful. You can build an entire bot from `Match` features alone. Here is an\nexample of a simple bot that will slap people on command.\n\n```python\nfrom chatbot.bots import Bot\nfrom chatbot.contrib.simple import Match\nfrom chatbot.chat import ChatResponse\n\nSLAP_OPTIONS = (\n\tChatResponse('slaps \\g\u003ctarget\u003e around a bit with a baseball bat', action=True),\n\tChatResponse('slaps \\g\u003ctarget\u003e around a bit with a large trout', action=True),\n\tChatResponse('slaps \\g\u003ctarget\u003e around a bit with a piano', action=True),\n\tChatResponse('slaps \\g\u003ctarget\u003e around a bit with a french fry', action=True),\n)\n\nbot = Bot(\n\tnickname = 'bestbot',\n\thostname = 'chat.freenode.net',\n\tport = 6665,\n\tserver_password = 'my_bots_password',\n\tchannels = ('#freenode', '#python'),\n\tfeatures = (\n\t\tMatch(r'slap (?P\u003ctarget\u003e[^\\s]+) (?P\u003cobject\u003e.+)', ChatResponse('slaps \\g\u003ctarget\u003e around a bit \\g\u003cobject\u003e', action=True), addressing_required=True, allow_continuation=False),\n\t\tMatch(r'slap (?P\u003ctarget\u003e.+)', SLAP_OPTIONS, addressing_required=True, allow_continuation=False),\n\t)\n)\n\nbot.run()\n```\n\nIn this case, the bot handles two possible matches. The first pattern matches sentences such as `bestbot: slap melinath with a frying pan` by responding with an action, `slaps melinath around a bit with a frying pan`. The second pattern matches commands to slap that do not specify the method of slapping (e.g., `slap melinath`), by choosing an option randomly from `SLAP_OPTIONS` (e.g., `slaps melinath around a bit with a french fry`).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrislapiroff%2Fpython-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrislapiroff%2Fpython-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrislapiroff%2Fpython-chatbot/lists"}