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.
Installation
pip install rocketbotte
Usage
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 messageon_command, fired when a command is trigged in a message, already defined withbot.on_commandfunctionon_ready, fired when the bot is readyon_close, never fired, , already defined withbot.on_closefunction 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")
Metadata
Release files for rocketbotte 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rocketbotte-0.2.4.tar.gz | 5.7 kB | Without provenance | Details for rocketbotte-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rocketbotte-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for rocketbotte-0.2.4-py3-none-any.whl |
Total release size: 12.7 kB
Release files / rocketbotte-0.2.4.tar.gz
| Download URL | rocketbotte-0.2.4.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39772c966d2061d9614944175806cbc00978f36e093d9507fe8e794c0d035dd2
|
|
BLAKE2b-256 checksum How to use checksums |
d22ea0b4851c00b5cdb9839c0715b5d0f0665eeb1df17283f08cb966c3423915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Release files / rocketbotte-0.2.4-py3-none-any.whl
| Download URL | rocketbotte-0.2.4-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0a23e6f0c7584f58d977548599cd3993db5c8e99f648065f31b7a39d50f2bc7
|
|
BLAKE2b-256 checksum How to use checksums |
1e8bbba87563e8b93734f5b327464db91734794fdd0257fd23558fdc37d3b45c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Security for rocketbotte 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.