def join_fed(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] administrators = chat.get_administrators() #if user.id in SUDO_USERS: # pass #else: for admin in administrators: status = admin.status if status == "creator": print(admin) if str(admin.user.id) == str(user.id): pass else: update.effective_message.reply_text( tld(chat.id, "Only group creator can do it!")) return if len(args) >= 1: sql.chat_join_fed(args[0], chat.id) update.effective_message.reply_text( tld(chat.id, "Chat joined to this federation!")) else: update.effective_message.reply_text( tld(chat.id, "Please write federation id to join!"))
def join_fed(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message administrators = chat.get_administrators() fed_id = sql.get_fed_id(chat.id) if user.id in SUDO_USERS: pass else: for admin in administrators: status = admin.status if status == "creator": print(admin) if str(admin.user.id) == str(user.id): pass else: update.effective_message.reply_text( tld(chat.id, "Only group creator can do it!")) return if fed_id: message.reply_text( tld(chat.id, "Uh, Are you gonna join two federations at one chat?")) return if len(args) >= 1: fedd = args[0] print(fedd) if sql.search_fed_by_id(fedd) == False: message.reply_text( tld(chat.id, "Please enter valid federation id.")) return x = sql.chat_join_fed(fedd, chat.id) if not x: message.reply_text( tld( chat.id, "Failed to join to federation! Due to some errors that basically I have no idea, try reporting it in support group!" )) return message.reply_text(tld(chat.id, "Chat joined to federation!"))
def join_fed(bot: Bot, update: Update, args: List[str]): spam = spamfilters(update.effective_message.text, update.effective_message.from_user.id, update.effective_chat.id) if spam == True: return update.effective_message.reply_text("Spammer detected! Ignoring user.") chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message administrators = chat.get_administrators() fed_id = sql.get_fed_id(chat.id) if user.id in SUDO_USERS: pass else: for admin in administrators: status = admin.status if status == "creator": if str(admin.user.id) == str(user.id): pass else: update.effective_message.reply_text("Only group creators can use this command!") return if fed_id: message.reply_text("You cannot join two federations from one chat") return if len(args) >= 1: getfed = sql.search_fed_by_id(args[0]) if getfed == False: message.reply_text("Please enter a valid federation ID") return x = sql.chat_join_fed(args[0], chat.id) if not x: message.reply_text("Failed to join federation! Please contact @onepunchsupport if this problem still persists!") return message.reply_text("This chat has joined the federation: {}!".format(getfed['fname']))
def join_fed(bot: Bot, update: Update, args: List[str]): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message administrators = chat.get_administrators() fed_id = sql.get_fed_id(chat.id) if user.id in SUDO_USERS: pass else: for admin in administrators: status = admin.status if status == "creator": print(admin) if str(admin.user.id) == str(user.id): pass else: update.effective_message.reply_text("Only the group creator can do it!") return if fed_id: message.reply_text("Uh, you can only join one federation in a chat.") return if len(args) >= 1: fedd = args[0] print(fedd) if sql.search_fed_by_id(fedd) == False: message.reply_text("Please enter a valid federation ID.") return x = sql.chat_join_fed(fedd, chat.id) if not x: message.reply_text("Failed to join federation! Please head to @tohsakas to report this.") return message.reply_text("Chat successfully added to federation!")