Пример #1
0
async def on_message(message):
    pre = get_prefix
    print (pre)
    if message.author == client.user:
        return

    # handle help and all of the playbook interactions
    response = plain_command_handler(message)

    if response:
        await message.channel.send(response)
        return

    response = embed_command_handler(message)

    if response:
        await message.channel.send(embed=response)
        return

    #list moves
    move_list = get_moves(message)

    if move_list:
        await message.channel.send(move_list)
        return

    #remember generic ! should always be last in the tree
    elif message.content.startswith("!"):
        log_line = message.guild.name + "|" + message.channel.name + "|" + message.author.name + "|" + message.content
        logger.info(log_line)
        response =  mad_parse(message)
        if response: await message.channel.send(embed=response)

    await client.process_commands(message)
Пример #2
0
async def on_message(message):
    if message.author == client.user:
        return

    # handle help and all of the playbook interactions
    if message.content.startswith("!"):
        response = plain_command_handler(message)

        if response:
            log_line = msg_log_line(message)
            logger.info(log_line)
            await message.channel.send(response)
            return

        response = embed_command_handler(message)

        if response:
            log_line = msg_log_line(message)
            logger.info(log_line)
            await message.channel.send(embed=response)
            return

    #answer a call for help
    if message.content.startswith("!help"):
        log_line = msg_log_line(message)
        logger.info(log_line)
        help_file = open("help", "r")
        response = help_file.read()

        await message.author.send(response)
        await message.channel.send("I have sent help to your PMs.")

    #list moves#
    if message.content.startswith("!"):
        move_list = get_moves(message)
        if move_list:
            await message.channel.send(move_list)
        #remember generic ! should always be last in the tree#
        else:
            log_line = msg_log_line(message)
            logger.info(log_line)
            response = mad_parse(message)
            if response:
                logger.info(response)
                (response, addendum) = response
                #            if addendum is not None:  ##testing if going first made a difference
                #                await message.channel.send(content = addendum)
                await message.channel.send(embed=response)
                if addendum is not None:
                    await message.channel.send(content=addendum)
            else:
                logger.info('no match found for ' + message.content)
Пример #3
0
async def on_message(message):
    if message.author == client.user:
        return

    lang = get_raw_lang(message)

    # handle help and all of the playbook interactions
    response = plain_command_handler(message, lang)

    if response:
        log_line = message.guild.name + "|" + message.channel.name + "|" + message.author.name + "|" + message.content
        logger.info(log_line)
        await message.channel.send(response)
        return

    response = embed_command_handler(message, lang)

    if response:
        log_line = message.guild.name + "|" + message.channel.name + "|" + message.author.name + "|" + message.content
        logger.info(log_line)
        await message.channel.send(embed=response)
        return

    #answer a call for help
    if message.content.startswith("!help"):
        log_line = message.guild.name + "|" + message.channel.name + "|" + message.author.name + "|" + message.content
        logger.info(log_line)
        help_file = open("help", "r")
        response = help_file.read()

        await message.author.send(response)
        await message.channel.send("I have sent help to your PMs.")

    #list moves#
    move_list = get_moves(message, lang)
    if move_list:
        await message.channel.send(move_list)
    #remember generic ! should always be last in the tree#
    elif message.content.startswith("!"):
        log_line = message.guild.name + "|" + message.channel.name + "|" + message.author.name + "|" + message.content
        logger.info(log_line)
        response = mad_parse(message)
        if response:
            logger.info(response)
            await message.channel.send(embed=response)
        else:
            logger.info('no match found for ' + message.content)