Skip to main content

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

Project description

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()

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")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rocketbotte-0.2.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rocketbotte-0.2.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file rocketbotte-0.2.2.tar.gz.

File metadata

  • Download URL: rocketbotte-0.2.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.2 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for rocketbotte-0.2.2.tar.gz
Algorithm Hash digest
SHA256 79adc0bcd8b0276fe23ea54c2a113cb98385fc6b0200e90f4f9edfa0368b8477
MD5 57336476db4242d843fdb3eff3d1f962
BLAKE2b-256 85b92d1738364e939f0b0ecbbe328515efeb339d19369707a75c8a4c9629d1fb

See more details on using hashes here.

File details

Details for the file rocketbotte-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rocketbotte-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.2 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for rocketbotte-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c825388a294afd497f2dc928dfa0a857a437d22da90acfd247621b307eb680
MD5 478793fe26a1f2535f9fc7a49440d287
BLAKE2b-256 ffd2c086be5a903ba1b93813cc3f560466f76fb938751c81adffce2c510cabe2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page