Skip to main content

Python lib for create rocketchat bot with getupdate like TelegramBots

Project description

RocketPyBot

Python lib for create rocketchat bot with getupdate like TelegramBots

This library is based on rocketchat_API

Installation

pip install pyrocketbot

Usage

import os
from pyrocketbot import RocketBot

username = os.environ.get('ROCKET_USERNAME')
password = os.environ.get('ROCKET_PASSWORD')
server_url = os.environ.get('ROCKET_SERVER_URL')

proxy_dict = {
    "http"  : "http://127.0.0.1:2080",
    "https" : "https://127.0.0.1:2080",
}

bot = RocketBot(username, password, server_url)
# bot = RocketBot(username, password, server_url, proxy_dict=proxy_dict)


@bot.command(r'/start')
def start(message, match_list):
    bot.send_message(message['rid'], 'hi')

@bot.command(r'/echo (.*)')
def echo(message, match_list):
    bot.send_message(message['rid'], match_list[0])


if __name__ == '__main__':
    print('Bot started')
    bot.run(chat_type='d', sleep=0.5)

Note :

in run method you can set chat_type to 'd' for direct message or 'c' for channel message and set sleep for sleep time per update

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

pyrocketbot-1.0.5.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

pyrocketbot-1.0.5-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pyrocketbot-1.0.5.tar.gz.

File metadata

  • Download URL: pyrocketbot-1.0.5.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for pyrocketbot-1.0.5.tar.gz
Algorithm Hash digest
SHA256 60f2613fbee457bdd99c4f7433c1d91ae1475e4b83fd62714955da942d0edce3
MD5 1b4f026e865ed97dafd92df3159c0e9a
BLAKE2b-256 a54ff999a14ce26585309ba81ba0fec881ee2ee0042c220fbf9859b78327cd7a

See more details on using hashes here.

File details

Details for the file pyrocketbot-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyrocketbot-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for pyrocketbot-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 41e67925d225765793557c90fb9d703ac0f9d6c250ecec99449b1a25aa789d61
MD5 13f6d3f22b7632e762844e48e0b2f9fb
BLAKE2b-256 4cbd4ff75e4a6963f08523eeae70a04ea913adef7cca5338258aabb716b89451

See more details on using hashes here.

Supported by

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