X-Git-Url: http://git.kaliko.me/?p=sid.git;a=blobdiff_plain;f=README.rst;h=7b5d4920d0ecb3b9d1a52ecd1c15c1058ad5fbcd;hp=15cc8f64364ad879c9fe5997ce657d534bf83e26;hb=HEAD;hpb=bb9811987721c5443ec1b8f23a3bc47ac1604823 diff --git a/README.rst b/README.rst index 15cc8f6..7b5d492 100644 --- a/README.rst +++ b/README.rst @@ -5,63 +5,60 @@ sid an xmpp bot Getting sid ------------ -Currently unreleased, only a development version is available. +Currently unreleased on PyPi_. - http://git.kaliko.me/?p=sid.git +`git tagged` version and `master branch` should be stable though. -Getting the latest source code ------------------------------- +* Doc: https://kaliko.gitlab.io/sid/ +* git: https://gitlab.com/kaliko/sid.git +* Issue: https://gitlab.com/kaliko/sid/-/issues -If you would instead like to use the latest source code, you can grab a copy -of the development version from git by running the command: - git clone git://git.kaliko.me/sid.git - - -Installing from source ----------------------- - -To install sid from source, simply run the command (within a virtualenv preferably):: - - python3 setup.py install - -You can use the `--help` switch to `setup.py` for a complete list of commands -and their options. See the `Installing Python Modules`_ document for more details. +Install/update master from git:: + pip install -U git+https://gitlab.com/kaliko/sid.git@master#egg=sid Using the bot ------------- Here is a plain example:: - #!/usr/bin/env python3 - # -*- coding: utf-8 -*- + #!/usr/bin/env python3 + # -*- coding: utf-8 -*- + + import getpass + import logging + from sid.sid import MUCBot + from sid.ping import Ping - import getpass - from sid.sid import MUCBot - from sid.ping import Ping + logging.basicConfig(level=logging.INFO, + format='%(levelname)-8s %(message)s') - JID = 'bot@example.org' - NICK = 'sid' - PASS = getpass.getpass('Password for "{}": '.format(JID)) - ROOM = 'room@conf.example.org' + JID = 'bot@example.org' + ROOM = 'room@conf.example.org' + # Pay attention: if you join the room with the same account/nick, + # For instance with a regular interactive client, the bot will + # not answer you, it ignores its own messages for obvious reasons. + NICK = 'sid' + PASS = getpass.getpass(f'Password for "{JID}": ') - xmpp = MUCBot(JID, PASS, ROOM, NICK) - xmpp.register_bot_plugin(Ping) - # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - xmpp.process(block=True) - xmpp.shutdown_plugins() - xmpp.log.info('Done') - else: - xmpp.log.info('Unable to connect.') + # Instanciate the bot + xmpp = MUCBot(JID, PASS, ROOM, NICK) + # Register a plugin + xmpp.register_bot_plugin(Ping) + # Connect to the XMPP server and start processing XMPP stanzas. + try: + xmpp.connect() + xmpp.process() + except KeyboardInterrupt: + xmpp.shutdown_plugins() -Contacting authors ------------------- + +Contacting author +----------------- The current maintainer can be found on xmpp chat room or you can contact him by email/xmpp . - .. _Installing Python Modules: http://docs.python.org/3/install/ - +.. _PyPI: https://pypi.org