def addtiger(update: Update, context: CallbackContext) -> str: message = update.effective_message user = update.effective_user chat = update.effective_chat bot, args = context.bot, context.args user_id = extract_user(message, args) user_member = bot.getChat(user_id) rt = "" reply = check_user_id(user_id, bot) if reply: message.reply_text(reply) return "" with open(ELEVATED_USERS_FILE, 'r') as infile: data = json.load(infile) if user_id in DRAGONS: rt += "Hard to handle *Dragon* powers? I see, entity demoted to *Knight.*" data['sudos'].remove(user_id) DRAGONS.remove(user_id) if user_id in DEMONS: rt += "This user is already a *Devil* entity, Demoted to *Knight.*" data['supports'].remove(user_id) DEMONS.remove(user_id) if user_id in WOLVES: rt += "This user is already a *Rook* entity, Demoted to *Knight.*" data['whitelists'].remove(user_id) WOLVES.remove(user_id) if user_id in TIGERS: message.reply_text("This user is already a *Knight.*") return "" data['tigers'].append(user_id) TIGERS.append(user_id) with open(ELEVATED_USERS_FILE, 'w') as outfile: json.dump(data, outfile, indent=4) update.effective_message.reply_text( rt + f"\nSuccessfully promoted {user_member.first_name} to a *Knight* entity!" ) log_message = ( f"#TIGER\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))} \n" f"<b>User:</b> {mention_html(user_member.id, html.escape(user_member.first_name))}" ) if chat.type != 'private': log_message = f"<b>{html.escape(chat.title)}:</b>\n" + log_message return log_message
def addsudo(update: Update, context: CallbackContext) -> str: message = update.effective_message user = update.effective_user chat = update.effective_chat bot, args = context.bot, context.args user_id = extract_user(message, args) user_member = bot.getChat(user_id) rt = "" reply = check_user_id(user_id, bot) if reply: message.reply_text(reply) return "" with open(ELEVATED_USERS_FILE, 'r') as infile: data = json.load(infile) if user_id in DRAGONS: message.reply_text( "This member is already handeling a *Dragon* sacred gear!") return "" if user_id in DEMONS: rt += "*BOOOOST!*, Promoted a *Devil* entity to *Dragon* successfully." data['supports'].remove(user_id) DEMONS.remove(user_id) if user_id in WOLVES: rt += "*BOOOOST!*, Promoted a *Rook* entity to *Dragon.*" data['whitelists'].remove(user_id) WOLVES.remove(user_id) data['sudos'].append(user_id) DRAGONS.append(user_id) with open(ELEVATED_USERS_FILE, 'w') as outfile: json.dump(data, outfile, indent=4) update.effective_message.reply_text( rt + "\nAnother Issei? Huh?, {} aquired the powers of *Dragon!*".format( user_member.first_name)) log_message = ( f"#SUDO\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))}\n" f"<b>User:</b> {mention_html(user_member.id, html.escape(user_member.first_name))}" ) if chat.type != 'private': log_message = f"<b>{html.escape(chat.title)}:</b>\n" + log_message return log_message
def addsupport( update: Update, context: CallbackContext, ) -> str: message = update.effective_message user = update.effective_user chat = update.effective_chat bot, args = context.bot, context.args user_id = extract_user(message, args) user_member = bot.getChat(user_id) rt = "" reply = check_user_id(user_id, bot) if reply: message.reply_text(reply) return "" with open(ELEVATED_USERS_FILE, 'r') as infile: data = json.load(infile) if user_id in DRAGONS: rt += "I demoted this *Dragon*, to a *Devil* rank" data['sudos'].remove(user_id) DRAGONS.remove(user_id) if user_id in DEMONS: message.reply_text("This user is already a *Devil* entity.") return "" if user_id in WOLVES: rt += "*BOOOOST!*, promoted a *Rook* entity to *Devil*" data['whitelists'].remove(user_id) WOLVES.remove(user_id) data['supports'].append(user_id) DEMONS.append(user_id) with open(ELEVATED_USERS_FILE, 'w') as outfile: json.dump(data, outfile, indent=4) update.effective_message.reply_text( rt + f"\n{user_member.first_name} we got a new *Devil* here!") log_message = ( f"#SUPPORT\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))}\n" f"<b>User:</b> {mention_html(user_member.id, html.escape(user_member.first_name))}" ) if chat.type != 'private': log_message = f"<b>{html.escape(chat.title)}:</b>\n" + log_message return log_message
def addwhitelist(update: Update, context: CallbackContext) -> str: message = update.effective_message user = update.effective_user chat = update.effective_chat bot, args = context.bot, context.args user_id = extract_user(message, args) user_member = bot.getChat(user_id) rt = "" reply = check_user_id(user_id, bot) if reply: message.reply_text(reply) return "" with open(ELEVATED_USERS_FILE, 'r') as infile: data = json.load(infile) if user_id in DRAGONS: rt += "This member is a Dragon Disaster, Demoting to Wolf." data['sudos'].remove(user_id) DRAGONS.remove(user_id) if user_id in DEMONS: rt += "This user is already a Demon Disaster, Demoting to Wolf." data['supports'].remove(user_id) DEMONS.remove(user_id) if user_id in WOLVES: message.reply_text("This user is already a Wolf Disaster.") return "" data['whitelists'].append(user_id) WOLVES.append(user_id) with open(ELEVATED_USERS_FILE, 'w') as outfile: json.dump(data, outfile, indent=4) update.effective_message.reply_text( rt + f"\nSuccessfully promoted {user_member.first_name} to a Wolf Disaster!" ) log_message = ( f"#WHITELIST\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))} \n" f"<b>User:</b> {mention_html(user_member.id, html.escape(user_member.first_name))}" ) if chat.type != 'private': log_message = f"<b>{html.escape(chat.title)}:</b>\n" + log_message return log_message
def removesupport(update: Update, context: CallbackContext) -> str: message = update.effective_message user = update.effective_user chat = update.effective_chat bot, args = context.bot, context.args user_id = extract_user(message, args) user_member = bot.getChat(user_id) reply = check_user_id(user_id, bot) if reply: message.reply_text(reply) return "" with open(ELEVATED_USERS_FILE, 'r') as infile: data = json.load(infile) if user_id in DEMONS: message.reply_text( "The *Devils* don't go inside church!.. be a *human then!* (demoted to normal user) " ) DEMONS.remove(user_id) data['supports'].remove(user_id) with open(ELEVATED_USERS_FILE, 'w') as outfile: json.dump(data, outfile, indent=4) log_message = ( f"#UNSUPPORT\n" f"<b>Admin:</b> {mention_html(user.id, html.escape(user.first_name))}\n" f"<b>User:</b> {mention_html(user_member.id, html.escape(user_member.first_name))}" ) if chat.type != 'private': log_message = f"<b>{html.escape(chat.title)}:</b>\n" + log_message return log_message else: message.reply_text("This user is not a *Devil!*") return ""