コード例 #1
0
ファイル: chat.py プロジェクト: ArtOfCode-/ChatExchange
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()
コード例 #2
0
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()
コード例 #3
0
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()
コード例 #4
0
ファイル: bot.py プロジェクト: wen1now/Shiro
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()
コード例 #5
0
ファイル: launch.py プロジェクト: CrazyPython/sanbot2
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()
コード例 #6
0
ファイル: bot.py プロジェクト: Filnor/Open-Reports
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
コード例 #7
0
ファイル: support.py プロジェクト: moon-chilled/SEProxy
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")
コード例 #8
0
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()
コード例 #9
0
    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()