fixed /setadmin function
This commit is contained in:
@@ -136,7 +136,7 @@ def set_admin(message):
|
||||
bot.reply_to(message, "You have to be an admin to use this command")
|
||||
return
|
||||
|
||||
bot.send_message(chat_id=user_id, text='send email and "true" if this account should have admin rights, else "false"\n in format: <email>,<is_admin>') # ask for email and admin rights to set
|
||||
bot.send_message(chat_id=user_id, text='send email and true if this account should have admin rights, else false\n in format: <email>,<is_admin>') # request email and admin rights to change to
|
||||
bot.register_next_step_handler(message, set_admin_step)
|
||||
|
||||
def set_admin_step(message):
|
||||
@@ -149,8 +149,11 @@ def set_admin_step(message):
|
||||
return
|
||||
|
||||
email = args_message[0]
|
||||
is_admin = args_message[1]
|
||||
|
||||
is_admin = False # default: False
|
||||
|
||||
if args_message[1].lower() == "true": # if user types true, set is_admin to true
|
||||
is_admin = True
|
||||
|
||||
status = api_handler.set_admin(email, is_admin) # set admin in db
|
||||
|
||||
if(status == 200):
|
||||
|
||||
Reference in New Issue
Block a user