Beispiel #1
0
async def on_message(message):
    # check if message author is a bot
    if message.author.bot:
        # check if sent by self
        if message.author.id == bot.user.id:
            await bot_message_cleanup(message)
        return
    if await is_Gagged(message):
        return

    if message.content.startswith('!'):
        if message.content.startswith('!!'):
            case_sensitive_toggle = True
        else:
            case_sensitive_toggle = False

        # message content should look like this
        # ![character] [move]

        userMessage = message.content
        userMessage = userMessage.replace("!", "")
        user_message_list = userMessage.split(" ", 1)

        if len(user_message_list) <= 1:
            print('! command used, but character not found/move not given\n')
            return

        user_Chara_Name = user_message_list[0]
        user_Chara_Move = user_message_list[1]

        #TODO: IMPLEMENT CHARACTER SHORTHAND NAME CONVERTER, OR CHARACTER NAMELIST DISPLAY
        character_name_string = tekkenFinder.does_char_exist(user_Chara_Name)

        if character_name_string:
            user_Chara_Name = character_name_string.lower()
            move_attribute_dict = tekkenFinder.get_Move_Details(user_Chara_Name,
                                                                user_Chara_Move,
                                                                case_sensitive_toggle)

            if move_attribute_dict:  # if dictionary not empty, move found
                embed_MoveFound = await get_MoveFound_Embed(**move_attribute_dict)
                await bot.send_message(message.channel, embed=embed_MoveFound)

            else:  # dictionary is empty, move not found
                embed_SimilarMoves = await get_SimilarMoves_Embed(user_Chara_Name,user_Chara_Move)
                await bot.send_message(message.channel, embed=embed_SimilarMoves)

            await user_message_cleanup(message)
            return

        else:
            await bot.send_message(message.channel, 'Character not found: ' + '**' + user_Chara_Name + '**')
            return

    await bot.process_commands(message)
Beispiel #2
0
async def on_message(message):
    #check if message author is a bot
    if message.author.bot:
        return
    if await is_Gagged(message) == True:
        return

    if message.content.startswith('!'):
        if message.content.startswith('!!'):
            case_sensitive_toggle = 1
        else:
            case_sensitive_toggle = 0

        #message content should look like this
        #![character] [move]

        userMessage = message.content
        userMessage = userMessage.replace("!", "")
        user_message_list = userMessage.split(" ", 1)

        if len(user_message_list) <= 1:
            print('! command used, but character not found/move not given\n')
            return

        user_Chara_Name = user_message_list[0]
        user_Chara_Move = user_message_list[1]

        if user_Chara_Name == 'dvj' or user_Chara_Name == 'deviljin':
            user_Chara_Name = 'devil_jin'
        if user_Chara_Name == 'jack':
            user_Chara_Name = 'jack7'
        if user_Chara_Name == 'raven':
            user_Chara_Name = 'master_raven'
        if user_Chara_Name == 'yoshi':
            user_Chara_Name = 'yoshimitsu'
        if user_Chara_Name == 'chloe':
            user_Chara_Name = 'lucky_chloe'

        #TODO: IMPLEMENT CHARACTER SHORTHAND NAME CONVERTER, OR CHARACTER NAMELIST DISPLAY
        characterExists = tekkenFinder.does_char_exist(user_Chara_Name)

        if characterExists == 1:
            user_Chara_Name = user_Chara_Name.lower()
            move_attribute_dict = tekkenFinder.get_Move_Details(
                user_Chara_Name, user_Chara_Move, case_sensitive_toggle)

            if bool(move_attribute_dict):  #if dictionary not empty, move found
                embed_MoveFound = await get_MoveFound_Embed(
                    **move_attribute_dict)
                await bot.send_message(message.channel, embed=embed_MoveFound)
                return

            else:  #dictionary is empty, move not found
                embed_SimilarMoves = await get_SimilarMoves_Embed(
                    user_Chara_Name, user_Chara_Move)
                await bot.send_message(message.channel,
                                       embed=embed_SimilarMoves)
                return

        elif characterExists == 0:
            await bot.send_message(
                message.channel,
                'Character not found: ' + '**' + user_Chara_Name + '**')
            return

    await bot.process_commands(message)