Esempio n. 1
0
    async def end_of_names(connection, channel, prefix=None):
        # Deregister RPL_NAMERPLY callback
        client.off(RPL_NAMEREPLY, receive_names)

        client.add_msg(channel, "Members: ")
        for name in names:
            client.add_msg(channel, "    " + name)
Esempio n. 2
0
async def client_join(connection, channel, prefix=None):
    """Displays a message when a user JOINs the chat.

    Begins listening for a NAMES reply, if the message was
    an echo of our own JOIN.
    """
    client.add_msg(channel, "%s has joined the chat!" % prefix)
    if prefix == client.nickname:
        listen_for_names()
Esempio n. 3
0
async def on_nick_collision(connection, nick, *params, prefix=None):
    client.add_msg('SYSTEM', "Nickname taken: %s" % nick)
    client.add_msg('SYSTEM', "You have been assigned an anonymous nickname" "")
    client.add_msg(
        'SYSTEM', "Type '/NICK ' followed by your nickname to choose a new one"
        "")
Esempio n. 4
0
async def on_already_registered(connection, msg, prefix=None):
    client.add_msg('SYSTEM', "Error: %s" % msg)
Esempio n. 5
0
async def on_need_more_params(connection, cmd, msg, prefix=None):
    client.add_msg('SYSTEM', "Error in cmd %s: %s" % (cmd, msg))
Esempio n. 6
0
async def on_nick_error(connection, nick, *params, prefix=None):
    client.add_msg('SYSTEM',
                   "Unable to set nickname. Invalid nickname: %s" % nick)
    client.add_msg('SYSTEM', "Nicknames must respect the following rules:")
    client.add_msg('SYSTEM', "   1. Between 1 and 9 characters long")
    client.add_msg('SYSTEM', "   2. Start with a letter")
    client.add_msg(
        'SYSTEM',
        R"   3. Contain only letters, numbers, and the following special characters: -[]\|`^{}"
    )
    client.add_msg('SYSTEM',
                   "Type '/NICK ' followed by a nickname to try again"
                   "")
Esempio n. 7
0
async def on_nick_in_use(connection, nick, *params, prefix=None):
    client.add_msg('SYSTEM',
                   "Unable to set nickname. Nickname taken: %s" % nick)
    client.add_msg('SYSTEM',
                   "Type '/NICK ' followed by a nickname to try again"
                   "")
Esempio n. 8
0
async def client_quit(connection, msg, prefix=None):
    """Displays a message when a user QUITs the chat"""
    client.add_msg(prefix, "*left the chat: %s*" % msg)
Esempio n. 9
0
async def receive_message(connection, receivers, msg, prefix=None):
    """Displays received messages in the View"""
    client.add_msg(prefix, msg)
Esempio n. 10
0
async def on_nick(connection, nick, prefix=None):
    if prefix == client.nickname:
        client.nickname = nick
    else:
        client.add_msg(prefix, "*changed their nickname to %s*" % nick)