]> kaliko git repositories - sid.git/blob - README.rst
Cleanup logging
[sid.git] / README.rst
1 ===============
2 sid an xmpp bot
3 ===============
4
5 Getting sid
6 ------------
7
8 Currently unreleased on PyPi_.
9
10 `git tagged` version and `master branch` should be stable though.
11
12 * Doc:   https://kaliko.gitlab.io/sid/
13 * git:   https://gitlab.com/kaliko/sid.git
14 * Issue: https://gitlab.com/kaliko/sid/-/issues
15
16
17 Get the source with git::
18
19   git clone git://git.kaliko.me/sid.git
20
21 Install/update master from git::
22
23   pip install -U git+https://gitlab.com/kaliko/sid.git@master#egg=sid
24
25 Using the bot
26 -------------
27
28 Here is a plain example::
29
30    #!/usr/bin/env python3
31    # -*- coding: utf-8 -*-
32
33    import getpass
34    import logging
35    from sid.sid import MUCBot
36    from sid.ping import Ping
37
38    logging.basicConfig(level=args.loglevel,
39                        format='%(levelname)-8s %(message)s')
40
41    JID = 'bot@example.org'
42    ROOM = 'room@conf.example.org'
43    # Pay attention: if you join the room with the same account/nick,
44    # For instance with a regular interactive client, the bot will
45    # not answer you, it ignores its own messages for obvious reasons.
46    NICK = 'sid'
47    PASS = getpass.getpass(f'Password for "{JID}": ')
48
49    # Instanciate the bot
50    xmpp = MUCBot(JID, PASS, ROOM, NICK)
51    # Register a plugin
52    xmpp.register_bot_plugin(Ping)
53
54    # Connect to the XMPP server and start processing XMPP stanzas.
55    try:
56        xmpp.connect()
57        xmpp.process()
58    except KeyboardInterrupt:
59        xmpp.shutdown_plugins()
60
61
62 Contacting author
63 -----------------
64
65 The current maintainer can be found on xmpp chat room <kaliko.me⊘conf.azylum.org>
66 or you can contact him by email/xmpp <kaliko⊘azylum.org>.
67
68 .. _PyPI: https://pypi.org