Exemple #1
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!")
    else:
        update.effective_message.reply_text("Usage restricted to PMs only")
Exemple #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("Sohbet bağlantısı kesildi!")
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
           update.effective_message.reply_text("Bağlantı kesilmesi başarısız!")
    else:
        update.effective_message.reply_text("Kullanım yalnızca PM'lerle sınırlıdır")
Exemple #3
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("कनेक्शन असफल")
    else:
        update.effective_message.reply_text("केवल पीएम तक सीमित!")
Exemple #4
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(
                "Rozłączono z czatem!")
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text("Rozołączenie nieudane!")
    else:
        update.effective_message.reply_text("Użycie ograniczone tylko do PW!")
Exemple #5
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(
                "කතාබස් වලින් විසන්ධි විය!")
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text("විසන්ධි කිරීම අසාර්ථකයි!")
    else:
        update.effective_message.reply_text("භාවිතය PM වලට පමණක් සීමා වේ")
Exemple #6
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("انقطاع فاشل!")
    else:
        update.effective_message.reply_text("الاستخدام يقتصر على PMS فقط")
Exemple #7
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(
                "Çatla əlaqə kəsildi!")
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text("Bağlantı alınmadı!")
    else:
        update.effective_message.reply_text(
            "İstifadə yalnız PM-lərlə məhdudlaşır!")
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(
                "Söhbətlə əlaqə uğurla dayandırıldı!")
            #Rebuild user's keyboard
            keyboard(bot, update)
        else:
            update.effective_message.reply_text(
                "Söhbətlə əlaqəni dayandırmaq uğursuz oldu!")
    else:
        update.effective_message.reply_text(
            "İstifadə yalnız PM-lərlə məhdudlaşır")
Exemple #9
0
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text("Invalid Chat ID provided!")
            if (bot.get_chat_member(connect_chat, update.effective_message.from_user.id).status in ('administrator', 'creator') or 
                                     (sql.allow_connect_to_chat(connect_chat) == True) and 
                                     bot.get_chat_member(connect_chat, update.effective_message.from_user.id).status in ('member')) or (
                                     user.id in SUDO_USERS):

                connection_status = sql.connect(update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(connected(bot, update, chat, user.id, need_admin=False)).title
                    update.effective_message.reply_text("Successfully connected to *{}*".format(chat_name), parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")
                    
                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3, number)
                        print(history.user_id, history.chat_id1, history.chat_id2, history.chat_id3, history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)
                    
                else:
                    update.effective_message.reply_text("Connection failed!")
            else:
                update.effective_message.reply_text("Connections to this chat not allowed!")
        else:
            update.effective_message.reply_text("Input chat ID to connect!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2, history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text("Usage limited to PMs only!")
Exemple #10
0
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text("चैट आईडी गलत है")
            if (bot.get_chat_member(
                    connect_chat, update.effective_message.from_user.id).status
                    in ('administrator', 'creator') or
                (sql.allow_connect_to_chat(connect_chat) == True)
                    and bot.get_chat_member(
                        connect_chat,
                        update.effective_message.from_user.id).status in
                ('member')) or (user.id in SUDO_USERS):

                connection_status = sql.connect(
                    update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(
                        connected(bot, update, chat, user.id,
                                  need_admin=False)).title
                    update.effective_message.reply_text(
                        " *{}* से सफलतापूर्वक जुड़ा हुआ है".format(chat_name),
                        parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")

                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3,
                                        number)
                        print(history.user_id, history.chat_id1,
                              history.chat_id2, history.chat_id3,
                              history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)

                else:
                    update.effective_message.reply_text("कनेक्शन फ़ैल!")
            else:
                update.effective_message.reply_text(
                    "इस चैट के कनेक्शनों को अनुमति नहीं है!")
        else:
            update.effective_message.reply_text(
                "कनेक्ट करने के लिए चैट आईडी इनपुट करे!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2,
                  history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text("केवल पीएम तक सीमित!")
Exemple #11
0
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text(
                    "Podano nieprawidłowy Chat ID!")
            if (bot.get_chat_member(
                    connect_chat, update.effective_message.from_user.id).status
                    in ('administrator', 'creator') or
                (sql.allow_connect_to_chat(connect_chat) == True)
                    and bot.get_chat_member(
                        connect_chat,
                        update.effective_message.from_user.id).status in
                ('member')) or (user.id in SUDO_USERS):

                connection_status = sql.connect(
                    update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(
                        connected(bot, update, chat, user.id,
                                  need_admin=False)).title
                    update.effective_message.reply_text(
                        "Successfully connected to *{}*".format(chat_name),
                        parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")

                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3,
                                        number)
                        print(history.user_id, history.chat_id1,
                              history.chat_id2, history.chat_id3,
                              history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)

                else:
                    update.effective_message.reply_text("Połączenie nieudane!")
            else:
                update.effective_message.reply_text(
                    "Połączenia do tego czatu są zabronione!")
        else:
            update.effective_message.reply_text("Podaj chat ID żeby połączyć!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2,
                  history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text("Użycie tylko przez PW!")
Exemple #12
0
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text(
                    "අවලංගු චැට් හැඳුනුම්පත ලබා දී ඇත!")
            if (bot.get_chat_member(
                    connect_chat, update.effective_message.from_user.id).status
                    in ('administrator', 'creator') or
                (sql.allow_connect_to_chat(connect_chat) == True)
                    and bot.get_chat_member(
                        connect_chat,
                        update.effective_message.from_user.id).status in
                ('member')) or (user.id in SUDO_USERS):

                connection_status = sql.connect(
                    update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(
                        connected(bot, update, chat, user.id,
                                  need_admin=False)).title
                    update.effective_message.reply_text(
                        "සමඟ සාර්ථකව සම්බන්ධ වී ඇත*{}*".format(chat_name),
                        parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")

                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3,
                                        number)
                        print(history.user_id, history.chat_id1,
                              history.chat_id2, history.chat_id3,
                              history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)

                else:
                    update.effective_message.reply_text(
                        "සම්බන්ධතාවය අසාර්ථක විය!")
            else:
                update.effective_message.reply_text(
                    "මෙම කතාබහට සම්බන්ධ වීමට අවසර නැත!")
        else:
            update.effective_message.reply_text(
                "සම්බන්ධ වීමට චැට් හැඳුනුම්පත ඇතුළත් කරන්න!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2,
                  history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text("භාවිතය PM වලට පමණක් සීමා වේ!")
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text(
                    "Invalid Chat ID provided!")
            if (bot.get_chat_member(
                    connect_chat, update.effective_message.from_user.id).status
                    in ('administrator', 'creator') or
                (sql.allow_connect_to_chat(connect_chat) == True)
                    and bot.get_chat_member(
                        connect_chat,
                        update.effective_message.from_user.id).status in
                ('member')) or (user.id in SUDO_USERS):

                connection_status = sql.connect(
                    update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(
                        connected(bot, update, chat, user.id,
                                  need_admin=False)).title
                    update.effective_message.reply_text(
                        "*{}* söhbətinə uğurla qoşuldu".format(chat_name),
                        parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")

                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3,
                                        number)
                        print(history.user_id, history.chat_id1,
                              history.chat_id2, history.chat_id3,
                              history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)

                else:
                    update.effective_message.reply_text("Əlaqə uğursuz oldu!")
            else:
                update.effective_message.reply_text(
                    "Bu söhbətıə əlaqələr deaktiv edilib!")
        else:
            update.effective_message.reply_text(
                "Əlaqə yaratmaq üçün Chat İD verin!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2,
                  history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text(
            "İstifadə yalnız PM-lərlə məhdudlaşır!")
Exemple #14
0
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text(
                    "معرف الدردشة غير صالح المقدمة!")
            if (bot.get_chat_member(
                    connect_chat, update.effective_message.from_user.id).status
                    in ('administrator', 'creator') or
                (sql.allow_connect_to_chat(connect_chat) == True)
                    and bot.get_chat_member(
                        connect_chat,
                        update.effective_message.from_user.id).status in
                ('member')) or (user.id in SUDO_USERS):

                connection_status = sql.connect(
                    update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(
                        connected(bot, update, chat, user.id,
                                  need_admin=False)).title
                    update.effective_message.reply_text(
                        "متصل بنجاح ب * {} *".format(chat_name),
                        parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")

                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3,
                                        number)
                        print(history.user_id, history.chat_id1,
                              history.chat_id2, history.chat_id3,
                              history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)

                else:
                    update.effective_message.reply_text("فشل الاتصال!")
            else:
                update.effective_message.reply_text(
                    "اتصالات إلى هذه الدردشة غير مسموح بها!")
        else:
            update.effective_message.reply_text(
                "إدخال محادثة المدخلات للاتصال!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2,
                  history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text("الاستخدام يقتصر على PMS فقط!")
Exemple #15
0
def connect_chat(bot, update, args):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    if update.effective_chat.type == 'private':
        if len(args) >= 1:
            try:
                connect_chat = int(args[0])
            except ValueError:
                update.effective_message.reply_text("Geçersiz Sohbet Kimliği sağlandı!")
            if (bot.get_chat_member(connect_chat, update.effective_message.from_user.id).status in ('administrator', 'creator') or 
                                     (sql.allow_connect_to_chat(connect_chat) == True) and 
                                     bot.get_chat_member(connect_chat, update.effective_message.from_user.id).status in ('member')) or (
                                     user.id in SUDO_USERS):

                connection_status = sql.connect(update.effective_message.from_user.id, connect_chat)
                if connection_status:
                    chat_name = dispatcher.bot.getChat(connected(bot, update, chat, user.id, need_admin=False)).title
                    update.effective_message.reply_text("Başarıyla bağlandı *{}*".format(chat_name), parse_mode=ParseMode.MARKDOWN)

                    #Add chat to connection history
                    history = sql.get_history(user.id)
                    if history:
                        #Vars
                        if history.chat_id1:
                            history1 = int(history.chat_id1)
                        if history.chat_id2:
                            history2 = int(history.chat_id2)
                        if history.chat_id3:
                            history3 = int(history.chat_id3)
                        if history.updated:
                            number = history.updated

                        if number == 1 and connect_chat != history2 and connect_chat != history3:
                            history1 = connect_chat
                            number = 2
                        elif number == 2 and connect_chat != history1 and connect_chat != history3:
                            history2 = connect_chat
                            number = 3
                        elif number >= 3 and connect_chat != history2 and connect_chat != history1:
                            history3 = connect_chat
                            number = 1
                        else:
                            print("Error")
                    
                        print(history.updated)
                        print(number)

                        sql.add_history(user.id, history1, history2, history3, number)
                        print(history.user_id, history.chat_id1, history.chat_id2, history.chat_id3, history.updated)
                    else:
                        sql.add_history(user.id, connect_chat, "0", "0", 2)
                    #Rebuild user's keyboard
                    keyboard(bot, update)
                    
                else:
                    update.effective_message.reply_text("Bağlantı başarısız oldu!")
            else:
                update.effective_message.reply_text("Bu sohbete bağlantılara izin verilmiyor!")
        else:
            update.effective_message.reply_text("Bağlanmak için sohbet kimliğini girin!")
            history = sql.get_history(user.id)
            print(history.user_id, history.chat_id1, history.chat_id2, history.chat_id3, history.updated)

    else:
        update.effective_message.reply_text("Kullanım yalnızca PM'lerle sınırlıdır!")