mardi 24 novembre 2020

TypeError: can only concatenate str (not "function") to str .random str in in python telegram bot. i tried it into str(nature) but didnt work

def nature():
    outputs = [
        "Adamant", "Bashful", "Bold", "Brave", "Calm", "Careful", "Docile", "Gentle", "Hardy", "Hasty", "Impish", "Jolly", "Lax", "Lonely", "Mild", "Modest", "Naive", "Naughty", "Quiet", "Quirky", "Rash", "Relaxed", "Sassy", "Serious"]
    nature = random.choice(outputs)
    return 

def one(update: Update, context: CallbackContext) -> None:
    """Show new choice of buttons"""
    query = update.callback_query
    query.answer()
    keyboard = [
        [
            InlineKeyboardButton("Stats", callback_data=str(TWO)),
            InlineKeyboardButton("Move set", callback_data=str(THREE)),
            InlineKeyboardButton("IVs/EVs", callback_data=str(FOUR)),
            
        ]
    ]
    reply_markup = InlineKeyboardMarkup(keyboard)
    query.edit_message_caption(
        caption="<b>Lv.</b> 56 | <b>Nature:</b>" + nature +"\n<b>Types:</b> [Search Internet noob]                                                        \n<b>Exp.</b> 1,250,000", reply_markup=reply_markup, parse_mode=telegram.ParseMode.HTML
    )
    return FIRST



Aucun commentaire:

Enregistrer un commentaire