Skip to main content

A simple RocketChat command line client

Project description

rchat

build License: GPL v3

A simple RocketChat command line client

rchat --to #team "Hello World!"

Usage

rchat comes with a command line interface that allows you to send messages either to groups or direct people:

rchat --to @rita.cantaora "Hi Rita!"

The message can also be piped into the program via stdin:

echo "Hi!" | rchat --to #team

See help for more information:

See rchat --help.

Configuration

rchat needs to know at least the server url and user credentials to use the API. Those parameters can be given via command line option, set using an envvar or by setting them in a config file.

Base configuration options can be taken from the command line. Arguments given in the command line will override any other configuration.

--user TEXT      Username in RocketChat
--user-id TEXT   User id associated to a Token
--token TEXT     Personal Acces Token Name
--password TEXT  Password for user in RocketChat
--url TEXT       Url to the RocketChat server

They can also be set as a environment variable by prefixing them such as RCHAT_URL. Arguments set this way will take precedence over the ones in the config file.

To configure via file, place your parameters in toml format at ~/.config/rchat/config.toml:

[rchat]
user_id = 'a1d3f4dd..'
token = 'fjXkkf..'
url = 'https://rocketchat.myserver.net'

A specific config file can be given by passing the --config option or setting the RCHAT_CONFIG envvar.

Extra config files can be placed in the conf.d directory and all of them will be merged together using confight. Last values found in these files will override the previous ones, so the complete list of places to be searched, in the order that will be read are:

  • /etc/rchat/config.toml
  • /etc/rchat/conf.d/*
  • ~/.config/rchat/config.toml
  • ~/.config/rchat/conf.d

Meaning that the keys in files placed at ~/.config/rchat/conf.d will override the rest.

Development

From the root of the application directory, create a python environment, install the application in development mode along with its dependencies and run it locally:

virtualenv env
. env/bin/activate
pip install --upgrade pip
pip install -e . -r requirements.txt -r dev-requirements.txt

Tests can be run using tox (recommended):

pip install tox
tox

Or directly by calling py.test:

python -m pytest

TODO

  • Send private messages
  • Send message from stdin
  • Send message from files
  • Upload files
  • Upload images
  • Read messages
  • Listen to new messages
  • Autocomplete emojis
  • Autocomplete users
  • Autocomplete channels
  • Config file
  • Logging and debug
  • Debian Packaging
  • Bundled Packaging
  • Pypi version
  • Versioning script
  • Improve startup time
  • Define groups of users
  • Allow to get reactions
  • Allow for threads
  • Implement (pre|post) message hooks
  • Implement (pre|post) reaction hooks
  • Autocomplete names
  • Autocomplete channels
  • Open editor to compose message
  • Preview message in markdown viewer
  • Autoformat input as verbatim

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

rchat-0.0.2.tar.gz (16.9 kB view hashes)

Uploaded Source

Built Distribution

rchat-0.0.2-py3-none-any.whl (16.7 kB view hashes)

Uploaded Python 3

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