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

Installation

pip install rocketpybot

Usage

import os
from rocketpybot 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

rocketbotlib-0.0.1-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

Details for the file rocketbotlib-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rocketbotlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b94771797b23ab3dd615cbd2841097dce9726ae85132f3588378d4d6e793178b
MD5 3f9fa24dffede1ab2bce488a1ae489ea
BLAKE2b-256 2b24f3d8221471f0df46a229f8c9d5e46d6d1cb8197f2f0b0f0bf1cb80787199

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