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
Release history Release notifications | RSS feed
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
File details
Details for the file rocketbotlib-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: rocketbotlib-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b94771797b23ab3dd615cbd2841097dce9726ae85132f3588378d4d6e793178b |
|
MD5 | 3f9fa24dffede1ab2bce488a1ae489ea |
|
BLAKE2b-256 | 2b24f3d8221471f0df46a229f8c9d5e46d6d1cb8197f2f0b0f0bf1cb80787199 |