X-Git-Url: https://git.kaliko.me/?p=sid.git;a=blobdiff_plain;f=bot.py;h=42644bc457b77e85ee7016404ff4ca9cfc2b3cc7;hp=49409008b96393892dc6098241d99e743105e6aa;hb=2dd50775877e07ba7aba08bdb04c6b8b05fb6555;hpb=fb4bc89bf30a4f7385da69f9bf8efdab596c5230 diff --git a/bot.py b/bot.py index 4940900..42644bc 100644 --- a/bot.py +++ b/bot.py @@ -4,7 +4,7 @@ import getpass from sid.sid import MUCBot -from sid.echo import Echo +from sid.ping import Ping from sid.feeds import Feeds JID = 'bot@example.org' @@ -16,20 +16,13 @@ def main(): Feeds.TEMPO = 60 xmpp = MUCBot(JID, PASS, ROOM, NICK) xmpp.register_bot_plugin(Feeds) - # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) + xmpp.register_bot_plugin(Ping) + try: + xmpp.connect() + xmpp.process() + except KeyboardInterrupt: xmpp.shutdown_plugins() - xmpp.log.info('Done') - else: - xmpp.log.info('Unable to connect.') + xmpp.log.info('Done') # Script starts here if __name__ == '__main__':