]> kaliko git repositories - sid.git/blob - bot.py
Bump version
[sid.git] / bot.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 import getpass
5
6 from sid.sid import MUCBot
7 from sid.ping import Ping
8 from sid.feeds import Feeds
9
10 JID = 'bot@example.org'
11 NICK = 'sid'
12 PASS = getpass.getpass('Password for "{}": '.format(JID))
13 ROOM = 'room@conf.example.org'
14
15 def main():
16     Feeds.TEMPO = 60
17     xmpp = MUCBot(JID, PASS, ROOM, NICK)
18     xmpp.register_bot_plugin(Feeds)
19     xmpp.register_bot_plugin(Ping)
20     # Connect to the XMPP server and start processing XMPP stanzas.
21     if xmpp.connect():
22         # If you do not have the dnspython library installed, you will need
23         # to manually specify the name of the server if it does not match
24         # the one in the JID. For example, to use Google Talk you would
25         # need to use:
26         #
27         # if xmpp.connect(('talk.google.com', 5222)):
28         #     ...
29         xmpp.process(block=True)
30         xmpp.shutdown_plugins()
31         xmpp.log.info('Done')
32     else:
33         xmpp.log.info('Unable to connect.')
34
35 # Script starts here
36 if __name__ == '__main__':
37     main()
38
39 # VIM MODLINE
40 # vim: ai ts=4 sw=4 sts=4 expandtab