Пример #1
0
def main():
    server = settings.SERVER
    port = settings.PORT
    channel = settings.CHANNEL
    nickname = settings.NICKNAME

    lichessmate = lichess.LichessBot()

    # LenientDecodingBuffer attempts UTF-8 but falls back to latin-1 to avoid UnicodeDecoreError in all cases.
    irc.client.ServerConnection.buffer_class = buffer.LenientDecodingLineBuffer
    ircbot = IRCBot(channel, nickname, server, port, lichessmate, settings)

    try:
        # Start a new thread for running Lichess, send the ircbot instance to it.
        _thread.start_new_thread(run_lichess, (lichessmate, ircbot))
    except _thread.error:
        print_error('Error: Unable to start thread.')

    ircbot.start()