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 SUDO_USERS: rt += "Requested HA to deomote this Dragon to Demon" data['sudos'].remove(user_id) SUDO_USERS.remove(user_id) if user_id in SUPPORT_USERS: message.reply_text("This user is already a Demon Disaster.") return "" if user_id in WHITELIST_USERS: rt += "Requested HA to promote this Wolf Disaster to Demon" data['whitelists'].remove(user_id) WHITELIST_USERS.remove(user_id) data['supports'].append(user_id) SUPPORT_USERS.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} was added as a Demon Disaster!") log_message = ( f"#SUPPORT\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"<b>User:</b> {mention_html(user_member.id, 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(bot: Bot, update: Update, args: List[str]) -> str: message = update.effective_message user = update.effective_user chat = update.effective_chat 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 SUDO_USERS: rt += "HA'dan bu Ejderhayı Şeytan'a deomote etmesini istedi" data['sudos'].remove(user_id) SUDO_USERS.remove(user_id) if user_id in SUPPORT_USERS: message.reply_text("Bu kullanıcı zaten bir Şeytan Felaketi.") return "" if user_id in WHITELIST_USERS: rt += "HA'dan bu Kurt Felaketini Şeytan'a tanıtmasını istedi" data['whitelists'].remove(user_id) WHITELIST_USERS.remove(user_id) data['supports'].append(user_id) SUPPORT_USERS.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} İblis Felaketi olarak eklendi!") log_message = (f"#SUPPORT\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"<b>Kullanıcı:</b> {mention_html(user_member.id, user_member.first_name)}") if chat.type != 'private': log_message = f"<b>{html.escape(chat.title)}:</b>\n" + log_message return log_message