dotbot-neverland


Namedotbot-neverland JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryAdd your description here
upload_time2024-08-07 07:49:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # [dotbot-neverland](https://github.com/xjzh123/dotbot-neverland)

A hack.chat bot framework which is simple, powerful, robust.

PyPI: [dotbot-neverland](https://pypi.org/project/dotbot-neverland/)

Installation with pip: `pip install dotbot-neverland`

## Why?

- Well typed

  All kinds of message are typed and you have IntelliSense. No need to deal with messy and unpredictable json objects.

- We do the messy part

  You only need to deal with bot logic, with these things available for free:

  - Parse whisper and emote message from server message like `XXX whispered: ...`
  - List of online users
  - Current nickname of your bot
  - Query full user info with nickname
  - ...

- For the future

  Dotbot-neverland is designed for [asyncio](https://docs.python.org/3/library/asyncio.html).
  
  Also, it is written in the latest syntax of Python 3.12. Therefore, it only supports `python >= 3.12`.

**Why Not?** There are also some limitations. If you need one of the followings, we suggest you choose [hvicorn](https://github.com/Hiyoteam/hvicorn):

- Synchronous or threaded API
- Compatible with older versions of Python

## Quickstart

```py
import asyncio
import os

from dotbot_neverland import Bot, ChatEvent, Context, SelfJoinEvent, WhisperEvent

bot = Bot()


@bot.on("onlineSet")
async def hello(c: Context[SelfJoinEvent]):
    await c.bot.chat("Hello from dotbot-neverland!")


@bot.on("chat", "whisper")
async def ping(c: Context[ChatEvent | WhisperEvent]):
    if c.event.text == "ping":
        await c.reply("pong!")


asyncio.run(bot.connect("lounge", "ping", os.getenv("HC_PWD")))
```

## Documentation

[/docs](https://github.com/xjzh123/dotbot-neverland/tree/master/docs)

## TODO

- [x] Bypass DNS poisoning
- [x] Graceful ignore self
- [ ] Informative error message
  - [x] Error during parcing
- [x] Update-able chat message
- [x] Graceful shutdown
- [ ] Command-like system
- [ ] Reusable collection of listeners
- [ ] Profiling and optimization
- [ ] Hook system and logging
- [ ] anti rate-limit and warnings
  - [ ] modelling of common warnings
  - [ ] built-in auto reconnecting
  - [ ] ability to know whether a message is accepted by HC (difficult)
  - [ ] optional auto-retry mechanism
- [ ] Documentation
  - [x] Articles
  - [ ] Generated API reference
  - [ ] Docstrings

## Credits

- foolishbird by light/await

  This inspired me to start both making HC bots and learning Python.

- [hvicorn](https://github.com/Hiyoteam/hvicorn) by [0x24a](https://github.com/0x24a)

  This bot framework realized my dream of a "well typed" bot framework. It is very creative compared to previous bot frameworks, and dotbot-neverland references it heavily. Actually, the whole design of dotbot-neverland is inspired by hvicorn.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dotbot-neverland",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "xjzh123 <37945610+xjzh123@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/fa/f6/add130c39815b00a6f09d8256c1f465fdaf2436405546bbb7d2360fe9bc1/dotbot_neverland-0.1.3.tar.gz",
    "platform": null,
    "description": "# [dotbot-neverland](https://github.com/xjzh123/dotbot-neverland)\n\nA hack.chat bot framework which is simple, powerful, robust.\n\nPyPI: [dotbot-neverland](https://pypi.org/project/dotbot-neverland/)\n\nInstallation with pip: `pip install dotbot-neverland`\n\n## Why?\n\n- Well typed\n\n  All kinds of message are typed and you have IntelliSense. No need to deal with messy and unpredictable json objects.\n\n- We do the messy part\n\n  You only need to deal with bot logic, with these things available for free:\n\n  - Parse whisper and emote message from server message like `XXX whispered: ...`\n  - List of online users\n  - Current nickname of your bot\n  - Query full user info with nickname\n  - ...\n\n- For the future\n\n  Dotbot-neverland is designed for [asyncio](https://docs.python.org/3/library/asyncio.html).\n  \n  Also, it is written in the latest syntax of Python 3.12. Therefore, it only supports `python >= 3.12`.\n\n**Why Not?** There are also some limitations. If you need one of the followings, we suggest you choose [hvicorn](https://github.com/Hiyoteam/hvicorn):\n\n- Synchronous or threaded API\n- Compatible with older versions of Python\n\n## Quickstart\n\n```py\nimport asyncio\nimport os\n\nfrom dotbot_neverland import Bot, ChatEvent, Context, SelfJoinEvent, WhisperEvent\n\nbot = Bot()\n\n\n@bot.on(\"onlineSet\")\nasync def hello(c: Context[SelfJoinEvent]):\n    await c.bot.chat(\"Hello from dotbot-neverland!\")\n\n\n@bot.on(\"chat\", \"whisper\")\nasync def ping(c: Context[ChatEvent | WhisperEvent]):\n    if c.event.text == \"ping\":\n        await c.reply(\"pong!\")\n\n\nasyncio.run(bot.connect(\"lounge\", \"ping\", os.getenv(\"HC_PWD\")))\n```\n\n## Documentation\n\n[/docs](https://github.com/xjzh123/dotbot-neverland/tree/master/docs)\n\n## TODO\n\n- [x] Bypass DNS poisoning\n- [x] Graceful ignore self\n- [ ] Informative error message\n  - [x] Error during parcing\n- [x] Update-able chat message\n- [x] Graceful shutdown\n- [ ] Command-like system\n- [ ] Reusable collection of listeners\n- [ ] Profiling and optimization\n- [ ] Hook system and logging\n- [ ] anti rate-limit and warnings\n  - [ ] modelling of common warnings\n  - [ ] built-in auto reconnecting\n  - [ ] ability to know whether a message is accepted by HC (difficult)\n  - [ ] optional auto-retry mechanism\n- [ ] Documentation\n  - [x] Articles\n  - [ ] Generated API reference\n  - [ ] Docstrings\n\n## Credits\n\n- foolishbird by light/await\n\n  This inspired me to start both making HC bots and learning Python.\n\n- [hvicorn](https://github.com/Hiyoteam/hvicorn) by [0x24a](https://github.com/0x24a)\n\n  This bot framework realized my dream of a \"well typed\" bot framework. It is very creative compared to previous bot frameworks, and dotbot-neverland references it heavily. Actually, the whole design of dotbot-neverland is inspired by hvicorn.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Add your description here",
    "version": "0.1.3",
    "project_urls": {
        "Documentation": "https://github.com/xjzh123/dotbot-neverland/tree/master/docs",
        "Homepage": "https://github.com/xjzh123/dotbot-neverland",
        "Repository": "https://github.com/xjzh123/dotbot-neverland.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68a9d59bf9d9fdef42d8302655ab9759538eaeb53718ee6b0145e6a9100eb94c",
                "md5": "783654ac0837f9c35e5739975ea4d223",
                "sha256": "d31744f9bba49905a69a39e6143dc2e1fb718d7f6c56828d8777e1b8b6b46f72"
            },
            "downloads": -1,
            "filename": "dotbot_neverland-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "783654ac0837f9c35e5739975ea4d223",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 11074,
            "upload_time": "2024-08-07T07:49:18",
            "upload_time_iso_8601": "2024-08-07T07:49:18.542909Z",
            "url": "https://files.pythonhosted.org/packages/68/a9/d59bf9d9fdef42d8302655ab9759538eaeb53718ee6b0145e6a9100eb94c/dotbot_neverland-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "faf6add130c39815b00a6f09d8256c1f465fdaf2436405546bbb7d2360fe9bc1",
                "md5": "aeb6f6f4ef151b5fd74b836031e64a09",
                "sha256": "2c580ccac12237f13fae17af16ff26010b44fe9dbb24ab0bda427cec5b2ff386"
            },
            "downloads": -1,
            "filename": "dotbot_neverland-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "aeb6f6f4ef151b5fd74b836031e64a09",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 10344,
            "upload_time": "2024-08-07T07:49:20",
            "upload_time_iso_8601": "2024-08-07T07:49:20.464996Z",
            "url": "https://files.pythonhosted.org/packages/fa/f6/add130c39815b00a6f09d8256c1f465fdaf2436405546bbb7d2360fe9bc1/dotbot_neverland-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-07 07:49:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xjzh123",
    "github_project": "dotbot-neverland",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dotbot-neverland"
}
        
Elapsed time: 0.63441s