rocketbotte


Namerocketbotte JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/styfore/rocketbotte
SummaryA bot for rocketchat messaging, allowing you to react to messages or commands.
upload_time2025-07-25 14:38:34
maintainerNone
docs_urlNone
authorStyfore
requires_python<4.0,>=3.11
licenseNone
keywords rocketchat rocket chat bot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Rocketbotte

A bot for rocketchat messaging, allowing you to react to messages or commands.

It works with rocketchat's realtime api (websocket) to receive messages, and responds with the REST api. To do this, it uses the aiohttp python library.

- [rocketchat api documentation](https://developer.rocket.chat/apidocs/rocketchat-api)
- [rocketchat real time api (websocket)](https://developer.rocket.chat/apidocs/realtimeapi)

## Installation

`pip install rocketbotte`

## Usage

```python
from rocketbotte import Bot, Context, Message

bot = Bot(server_url=SERVER_URL, user_id=USER_ID, auth_token=AUTH_TOKEN)

@bot.command('test')
async def test(ctx:Context, args:str):
    await ctx.send_message(f'response to {args}')

@bot.listen()
async def on_message(message:Message):
    if 'hello' in message.content:
        await bot.send_message(message.room_id, 'world ')

bot.run()
```


### events and listenners

events can be trigged with `bot.fire_event(event_name:str)` method or created by adding a listenner `self.add_listener(func:Coroutine, name:str, [aliases:list])` or by the annotation `@bot.listen`. 
Three events are already defined or trigged in the process :
- `on_message`, fired on new message
- `on_command`, fired when a command is trigged in a message, already defined with `bot.on_command` function
- `on_ready`, fired when the bot is ready
- `on_close`, never fired, , already defined with `bot.on_close` function which close the websocket service



### Bot parameters

- server_url: the server url as `https://myrocketchat.org`
- auth_token: the personal authentification token for the bot
- command_prefix: default : '!'
- user_id: the user id who belongs to the authentification token
- max_retry: number of attempt restart after an uncaught exception, default to 5
- max_retry_time: seconds before new attemps of connexion, default to 30
- max_off_time: time in seconds since last ping from server worth a new connection, defaut te 120



## logging

This library use loguru for logging. To see logs explicit ask for by using  `logger.enable("rocketbotte")`
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/styfore/rocketbotte",
    "name": "rocketbotte",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "rocketchat, rocket chat, bot",
    "author": "Styfore",
    "author_email": "rocketbotte@styfore.ovh",
    "download_url": "https://files.pythonhosted.org/packages/2b/65/68323384735512c39b6e196190b6cb92c736f8364c7cd3e644b7a8f0c414/rocketbotte-0.2.3.tar.gz",
    "platform": null,
    "description": "# Rocketbotte\n\nA bot for rocketchat messaging, allowing you to react to messages or commands.\n\nIt works with rocketchat's realtime api (websocket) to receive messages, and responds with the REST api. To do this, it uses the aiohttp python library.\n\n- [rocketchat api documentation](https://developer.rocket.chat/apidocs/rocketchat-api)\n- [rocketchat real time api (websocket)](https://developer.rocket.chat/apidocs/realtimeapi)\n\n## Installation\n\n`pip install rocketbotte`\n\n## Usage\n\n```python\nfrom rocketbotte import Bot, Context, Message\n\nbot = Bot(server_url=SERVER_URL, user_id=USER_ID, auth_token=AUTH_TOKEN)\n\n@bot.command('test')\nasync def test(ctx:Context, args:str):\n    await ctx.send_message(f'response to {args}')\n\n@bot.listen()\nasync def on_message(message:Message):\n    if 'hello' in message.content:\n        await bot.send_message(message.room_id, 'world ')\n\nbot.run()\n```\n\n\n### events and listenners\n\nevents can be trigged with `bot.fire_event(event_name:str)` method or created by adding a listenner `self.add_listener(func:Coroutine, name:str, [aliases:list])` or by the annotation `@bot.listen`. \nThree events are already defined or trigged in the process :\n- `on_message`, fired on new message\n- `on_command`, fired when a command is trigged in a message, already defined with `bot.on_command` function\n- `on_ready`, fired when the bot is ready\n- `on_close`, never fired, , already defined with `bot.on_close` function which close the websocket service\n\n\n\n### Bot parameters\n\n- server_url: the server url as `https://myrocketchat.org`\n- auth_token: the personal authentification token for the bot\n- command_prefix:\u202fdefault : '!'\n- user_id: the user id who belongs to the authentification token\n- max_retry: number of attempt restart after an uncaught exception, default to 5\n- max_retry_time: seconds before new attemps of connexion, default to 30\n- max_off_time: time in seconds since last ping from server worth a new connection, defaut te 120\n\n\n\n## logging\n\nThis library use loguru for logging. To see logs explicit ask for by using  `logger.enable(\"rocketbotte\")`",
    "bugtrack_url": null,
    "license": null,
    "summary": "A bot for rocketchat messaging, allowing you to react to messages or commands.",
    "version": "0.2.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/styfore/rocketbotte/issues",
        "Homepage": "https://github.com/styfore/rocketbotte",
        "Repository": "https://github.com/styfore/rocketbotte"
    },
    "split_keywords": [
        "rocketchat",
        " rocket chat",
        " bot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee05bde5026f07bb1ba7f66ae6e8c2483ac9d4f028400f188abd0c2115dc8a9b",
                "md5": "3243e41d6546621a49a4f3ffa0f98066",
                "sha256": "34db9df0578b082b18b00eb489dd54847e8c65c2af6b5ecbb25358618dca5b3d"
            },
            "downloads": -1,
            "filename": "rocketbotte-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3243e41d6546621a49a4f3ffa0f98066",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 6934,
            "upload_time": "2025-07-25T14:38:33",
            "upload_time_iso_8601": "2025-07-25T14:38:33.758334Z",
            "url": "https://files.pythonhosted.org/packages/ee/05/bde5026f07bb1ba7f66ae6e8c2483ac9d4f028400f188abd0c2115dc8a9b/rocketbotte-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b6568323384735512c39b6e196190b6cb92c736f8364c7cd3e644b7a8f0c414",
                "md5": "9f396039d689d58799d27530cb6de27a",
                "sha256": "45ca1e9f501365f9765ffccb2c58bc2273ecf5489ed5c70db3c34ac40d6cd2f8"
            },
            "downloads": -1,
            "filename": "rocketbotte-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9f396039d689d58799d27530cb6de27a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 5806,
            "upload_time": "2025-07-25T14:38:34",
            "upload_time_iso_8601": "2025-07-25T14:38:34.612022Z",
            "url": "https://files.pythonhosted.org/packages/2b/65/68323384735512c39b6e196190b6cb92c736f8364c7cd3e644b7a8f0c414/rocketbotte-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 14:38:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "styfore",
    "github_project": "rocketbotte",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rocketbotte"
}
        
Elapsed time: 1.23266s