这里有一个以]开头的嵌套结构>
@bot.message_handler(content_types=["text"]) def handle_text (message, user_markup=None):
紧接着是嵌套结构,此函数将在其中
def wallet(message): if message.text == 'Wallet NST': sent=bot.send_message(message.chat.id, """Crypto currency is an Ethereum token. NST Smart Contract Token Address is as follows: (0xD89040Ac9823B72F64d71f66Fa2DeAE7C8520671). Please make sure you are using the right smart contract or your funds may be irretrievably lost. \n INFORM YOUR WALLET NST(NEW SOLUTION ) :""") bot.register_next_step_handler(sent, salva) def guard(message): archive=open('oriondb.txt', 'w') archive.write(int(messagefrom_user.id) + message.from_user.username + message.chat.text ) bot.send_message(message.chat.id, 'CARTEIRA SALVA COM SUCESSO!') bot.register_next_step_handler( handle_text)
我想将答案保存到txt文件或数据库中,如何使用pytelegramBotAPI做到这一点?
这里有一个嵌套结构,它以@ bot.message_handler(content_types = [“ text”])def handle_text(message,user_markup = None)开头:紧随其后的是嵌套结构和这个...
我认为它应该起作用:
@bot.message_handler(content_types=["text"])
def wallet(m):
cid = m.chat.id
if m.text == 'Wallet NST':
bot.register_next_step_handler(sent, salva)
sent=bot.send_message(cid, """Crypto currency is an Ethereum token.
NST Smart Contract Token Address is as follows:
(0xD89040Ac9823B72F64d71f66Fa2DeAE7C8520671).
Please make sure you are using the right smart contract or your funds may be
irretrievably lost. \n
INFORM YOUR WALLET NST(NEW SOLUTION ) :""")
archive=open('oriondb.txt', 'a')
archive.append(str(cid) + m.chat.username + m.chat.text )
bot.send_message(cid, 'CARTEIRA SALVA COM SUCESSO!')