1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import hashlib
- from datetime import datetime
- import config
- import jsonAndRequest as jsreq
- from EchoBot import JabberBot
- import logging
- from getpass import getpass
- from argparse import ArgumentParser
- import asyncio
- botname = "open_basic_bot"
- operating_status = 0
- JID = botname + "@" + config.JSERVER
- PASSWORD = hashlib.md5((botname + config.PASSWORD).encode('utf-8')).hexdigest()
- if __name__ == '__main__':
- # Setup the command line arguments.
- parser = ArgumentParser(description=JabberBot.__doc__)
- # Output verbosity options.
- parser.add_argument("-q", "--quiet", help="set logging to ERROR",
- action="store_const", dest="loglevel",
- const=logging.ERROR, default=logging.INFO)
- parser.add_argument("-d", "--debug", help="set logging to DEBUG",
- action="store_const", dest="loglevel",
- const=logging.DEBUG, default=logging.INFO)
- # JID and password options.
- # parser.add_argument("-b", "--bot", dest="bot",
- # help="Bot name")
- args = parser.parse_args()
- # Setup logging.
- logging.basicConfig(level=args.loglevel,
- format='%(levelname)-8s %(message)s')
- # if args.jid is None:
- # args.jid = input("Username: ")
- # if args.password is None:
- # args.password = getpass("Password: ")
- # Setup the EchoBot and register plugins. Note that while plugins may
- # have interdependencies, the order in which you register them does
- # not matter.
- xmpp = JabberBot(JID, PASSWORD)
- xmpp.send_message(JID, f"message send: {datetime.now()}")
- asyncio.get_event_loop().run_forever()
|