]> kaliko git repositories - sid.git/blob - bot.py
Add Debian BTS plugin
[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.echo import Echo
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     # Connect to the XMPP server and start processing XMPP stanzas.
20     if xmpp.connect():
21         # If you do not have the dnspython library installed, you will need
22         # to manually specify the name of the server if it does not match
23         # the one in the JID. For example, to use Google Talk you would
24         # need to use:
25         #
26         # if xmpp.connect(('talk.google.com', 5222)):
27         #     ...
28         xmpp.process(block=True)
29         xmpp.shutdown_plugins()
30         xmpp.log.info('Done')
31     else:
32         xmpp.log.info('Unable to connect.')
33
34 # Script starts here
35 if __name__ == '__main__':
36     main()
37
38 # VIM MODLINE
39 # vim: ai ts=4 sw=4 sts=4 expandtab