我想将用户ID添加到我不太了解如何创建或使用的数组或列表中。它应该看起来像:afklist = [userid,anotheruserid],并且当用户再次键入/ afk时,他应该从此列表中删除(在其他条件下)
@bot.message_handler(commands=['afk'])
def handle_text(message):
if any(afklist) == message.from_user.username:
answer = "{0} is now afk.".format(message.from_user.username)
bot.send_message(message.chat.id, answer)
else:
answer = "{0} is here again.".format(message.from_user.username)
bot.send_message(message.chat.id, answer)