def main(): setup_logging() # Run `. setp.sh` to set the below testing environment variables host_id = 'stackexchange.com' room_id = '14219' # Charcoal Chatbot Sandbox if 'ChatExchangeU' in os.environ: email = os.environ['ChatExchangeU'] else: email = raw_input("Email: ") if 'ChatExchangeP' in os.environ: password = os.environ['ChatExchangeP'] else: password = getpass.getpass("Password: "******"(You are now in room #%s on %s.)" % (room_id, host_id) while True: message = raw_input("<< ") room.send_message(message) client.logout()
def main(args): setup_logging() # Run `. setp.sh` to set the below testing environment variables host_id = 'stackexchange.com' room_id = '1' # Sandbox if 'ChatExchangeU' in os.environ: email = os.environ['ChatExchangeU'] else: email = input("Email: ") if 'ChatExchangeP' in os.environ: password = os.environ['ChatExchangeP'] else: password = getpass.getpass("Password: "******"(You are now in room #%s on %s.)" % (room_id, host_id)) while True: message = input("<< ") room.send_message(message) client.logout()
def main(): setup_logging() # Run `. setp.sh` to set the below testing environment variables host_id = 'stackexchange.com' room_id = '11540' # Sandbox email = "*****@*****.**" password = "******" client = chatexchange.client.Client(host_id) client.login(email, password) room = client.get_room(room_id) room.join() #room.watch(on_message) room.send_message(sys.argv[1]) print("(You are now in room #%s on %s.)" % (room_id, host_id)) while True: i = 0 client.logout()
def main(): global room init('0') host_id = 'stackexchange.com' room_id = '59120' # Sandbox if 'ChatExchangeU' in os.environ: email = os.environ['ChatExchangeU'] else: email = raw_input("Email: ") if 'ChatExchangeP' in os.environ: password = os.environ['ChatExchangeP'] else: password = getpass.getpass("Password: "******"(You are now in room #%s on %s.)" % (room_id, host_id)) while not shutdown: message = raw_input("<< ") room.send_message(message) client.logout()
def main(): setup_logging() # Run `. setp.sh` to set the below testing environment variables host_id = 'stackexchange.com' if not args.passive: room_id = '30332' else: room_id = '240' if 'ChatExchangeU' in os.environ: email = os.environ['ChatExchangeU'] else: email = raw_input("Email: ") if 'ChatExchangeP' in os.environ: password = os.environ['ChatExchangeP'] else: password = getpass.getpass("Password: "******"(You are now in room #%s on %s.)" % (room_id, host_id)) if not args.passive: room.send_message("{} restarted.".format(botname)) while True: time.sleep(100) client.logout()
def WatchRoom(mail, password, room): client = chatexchange.client.Client(room['hostID']) client.login(email, password) room = client.get_room(room['roomID']) room.join() room.send_message('[open] Hi o/') watcher = room.watch_socket(onMessage) return client, room, watcher
def doop(): client = chatexchange.client.Client('stackexchange.com') client.login(user, pw) room = client.get_room(roomname) room.join() room.watch(cb) stderr.write("Py stackexchange: success\n") stderr.flush() for l in stdin: if len(l.strip()): room.send_message(l.replace('\\n', '\n').replace('\\\\', '\\')) with open("test.txt", "a") as fp: fp.write(l.replace('\\n', '\n').replace('\\\\', '\\')) fp.write("\n")
def main(): host_id = 'stackexchange.com' room_id = '151' # Charcoal Chatbot Sandbox if 'ChatExchangeU' in os.environ: email = os.environ['ChatExchangeU'] else: email = raw_input("Email: ") if 'ChatExchangeP' in os.environ: password = os.environ['ChatExchangeP'] else: password = raw_input("Password: ") client = chatexchange.client.Client(host_id) client.login(email, password) room = client.get_room(room_id) room.join() room.watch(on_message) while True: time.sleep(1) client.logout()
try: handleCommand(message, command, userID) except Exception as e: message.room.send_message('Error occurred: ' + str(e) + ' (cc @Baum)') if 'ChatExchangeU' in os.environ: email = os.environ['ChatExchangeU'] else: email = input("Email: ") if 'ChatExchangeP' in os.environ: password = os.environ['ChatExchangeP'] else: password = input("Password: ") client = chatexchange.client.Client(hostID) client.login(email, password) print('Logged in') room = client.get_room(roomID) room.join() print('Joined room') room.send_message('[notepad] Hi o/') while True: watcher = room.watch_socket(onMessage) watcher.thread.join() client.logout()