Example #1
0
def disconnect_chat(bot, update):
    chat = update.effective_chat  # type: Optional[Chat]
    if update.effective_chat.type == 'private':
        disconnection_status = sql.disconnect(
            update.effective_message.from_user.id)
        if disconnection_status:
            sql.disconnected_chat = update.effective_message.reply_text(
                tld(chat.id, "connection_dis_success"))
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text(
                tld(chat.id, "connection_dis_fail"))
    elif update.effective_chat.type == 'supergroup':
        disconnection_status = sql.disconnect(
            update.effective_message.from_user.id)
        if disconnection_status:
            sql.disconnected_chat = update.effective_message.reply_text(
                tld(chat.id, "connection_dis_success"))
            # Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text(
                tld(chat.id, "connection_dis_fail"))
    else:
        update.effective_message.reply_text(tld(chat.id, "common_cmd_pm_only"))
Example #2
0
def disconnect_chat(bot, update):
    if update.effective_chat.type == 'private':
        disconnection_status = sql.disconnect(update.effective_message.from_user.id)
        if disconnection_status:
            sql.disconnected_chat = update.effective_message.reply_text("Disconnected from chat!")
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
           update.effective_message.reply_text("Disconnection unsuccessfull!")
    elif update.effective_chat.type == 'supergroup':
        disconnection_status = sql.disconnect(update.effective_message.from_user.id)
        if disconnection_status:
            sql.disconnected_chat = update.effective_message.reply_text("Disconnected from chat!")
            # Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text("Disconnection unsuccessfull!")
    else:
        update.effective_message.reply_text("Usage is restricted to PMs only")