def Your_Code(update,context):

    """
    ---- imports ----

    from Program.Send import Send as Send

    from Program.Button import Button as Button

    import Program.Get_Bot_Variables as Get_Bot_Variables

    import threading

    """

    Bot_Variables = Get_Bot_Variables.Func([update,context])

    # - Variables - #
    """
    TOKEN = Bot_Variables[0]
    Chat_ID = Bot_Variables[1]
    First_Name = Bot_Variables[2]
    UserName = Bot_Variables[3]
    Message = Bot_Variables[4]
    Message_ID = Bot_Variables[5]
    File_ID = Bot_Variables[6]
    Virtual_Location = Bot_Variables[7]
    User_Privileges = Bot_Variables[8]
    User_Lang = Bot_Variables[9]
    Mongo_Collections = Bot_Variables[10]
    Json_Message = Bot_Variables[11]
    Update = Bot_Variables[12]
    Other_Variables = Bot_Variables[13]
    Context = Bot_Variables[14]
    
    """

    """
    --- Send Class ---


Send.Message(Bot_Variables,"Paste Text Here")

Send.Keyboard(Bot_Variables, "Text Here",
                  Button.Markup("button 1"),
                  Button.Markup(Button.Markup_Location("Send_Location")),
                  Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6"))



#NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax:
# ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]
# the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction)

Send.Inline_Keyboard(Bot_Variables, "Text Here" ,
                         Button.Inline(  ["U","URL Button","https://www.google.co.il/"] ,  ["C","Callback Button","Template"] ) ,
                         Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"])
                         )

# send edited keyboard, its edit current inline keyboard and change buttons give deep navigation effect

Send.Edited_Inline_Keyboard(Bot_Variables,"Text Here",
                            Button.Inline(["u","URL Button","www.google.co.il"])
                            )


Send.Callback_Answer(Bot_Variables,"Callback Query Answer")

Send.Callback_Alert(Bot_Variables,"Callback Query Alert")

Send.Forword(Bot_Variables,from_chat_id,to_chat_id,message_id)


# send any file by file id , type : video/voice message/photo/document/sticker
Send.Any_File(Bot_Variables,file_id,caption)


--- Buttons Types ---

# regular markup button
Button.Markup("button text1","button text2")

# make button markup to send user location
Button.Markup_Location("button text")

# make button markup to send user phone number
Button.Markup_Phone("button text")

# regular inline button
Button.Inline( ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"])

#syntax:

* each time activated gives 1 rows of buttons


#Markup synatx
Send.Keyboard(Bot_Variables, "Text Here",
                  Button.Markup("button 1"),
                  Button.Markup(Button.Markup_Location("Send_Location")),
                  Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6"))


#Inline synatx
#NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax:
# ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]
# the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction)

Send.Inline_Keyboard(Bot_Variables, "Text Here" ,
                         Button.Inline(  ["U","URL Button","https://www.google.co.il/"] ,  ["C","Callback Button","Template"] ) ,
                         Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"])
                         )

    """



    Users = Bot_Variables[10][0]


    Chat_ID = Bot_Variables[1]

    Users.update_one({"chat_id": Chat_ID}, {"$set": {"random_chapter" : 92}})


    Send.Inline_Keyboard(Bot_Variables, Send_Book.Func(92,Bot_Variables),
                         Button.Inline(
                                       ["C", favoriets_name.Func(update,context), "add_random_chapter_to_favoeites"]),
                         Button.Inline(["C", "🔴 סמן כנקרא 🔴", "mark_random_as_read"])
                         )
Example #2
0
    def deep_linked(cls, update, context):
        cls.start(update, context)
        cls.Bot_Variables = Get_Bot_Variables.Func([update, context])
        deep_link = update["message"]["text"]
        seperator = ""

        for i in range(8, len(deep_link), 1):
            seperator = seperator + deep_link[i]

        if len(seperator) < 4:
            chapter = int(seperator)
            Users = cls.Bot_Variables[10][0]
            Users.update_one({"chat_id": cls.Bot_Variables[1]},
                             {"$set": {
                                 "random_chapter": chapter
                             }})

            Send.Inline_Keyboard(
                cls.Bot_Variables, Send_Book.Func(chapter, cls.Bot_Variables),
                Button.Inline([
                    "C",
                    favoriets_name.Func(update, context),
                    "add_random_chapter_to_favoeites"
                ]),
                Button.Inline([
                    "C", "🔴 סמן כנקר� 🔴", "mark_random_as_read"
                ]))

        Users = cls.Bot_Variables[10][0]
        Names = cls.Bot_Variables[10][2]

        name = Names.find_one({"seperator": seperator})

        men_name = name["name"]
        chat = name["chat_id"]

        to = name["for"]

        stats = name["chapters_stats"]

        Chapter = ""
        chapters_read = len(stats)

        if len(stats) < 150:
            for i in range(150):
                if (not i in stats):
                    Chapter = i
                    break

            Users.update_one(
                {"chat_id": cls.Bot_Variables[1]},
                {"$set": {
                    "read for name.name": [men_name, Chapter]
                }})
            Users.update_one({"chat_id": cls.Bot_Variables[1]},
                             {"$set": {
                                 "read for name.chat": chat
                             }})
            next = name["link"]

            llist = [Chapter, chapters_read, men_name, to, cls.Bot_Variables]

            t = SSend_chapter.Func(llist)

            Send.Inline_Keyboard(
                cls.Bot_Variables, t,
                Button.Inline([
                    "C", "⭕� סמן כנקר� ⭕�",
                    "mark_as_read_for_name"
                ]), Button.Inline(["u", "➕ פרק נוסף ➕�", next]))
        else:
            text = " ✡✅ קרי�ת פרקי ספר התהילי� {} {} הסתיימה בהצלחה ✅�✡����".format(
                to, men_name)
            Send.Message(cls.Bot_Variables, text)
Example #3
0
def Func(update, context):
    """
    ---- imports ----

    import Program.Get_Bot_Variables as Get_Bot_Variables

    from Program.Send import Send as Send

    from Program.Button import Button as Button

    """

    Bot_Variables = Get_Bot_Variables.Func([update, context])

    # - Variables - #
    """
    TOKEN = Bot_Variables[0]
    Chat_ID = Bot_Variables[1]
    First_Name = Bot_Variables[2]
    UserName = Bot_Variables[3]
    Message = Bot_Variables[4]
    Message_ID = Bot_Variables[5]
    File_ID = Bot_Variables[6]
    Virtual_Location = Bot_Variables[7]
    User_Privileges = Bot_Variables[8]
    User_Lang = Bot_Variables[9]
    Mongo_Collections = Bot_Variables[10]
    Json_Message = Bot_Variables[11]
    Update = Bot_Variables[12]
    Other_Variables = Bot_Variables[13]
    Context = Bot_Variables[14]
    
    """
    """
    --- Send Class ---


Send.Message(Bot_Variables,"Paste Text Here")

Send.Keyboard(Bot_Variables, "Text Here",
                  Button.Markup("button 1"),
                  Button.Markup(Button.Markup_Location("Send_Location")),
                  Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6"))



#NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax:
# ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]
# the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction)

Send.Inline_Keyboard(Bot_Variables, "Text Here" ,
                         Button.Inline(  ["U","URL Button","https://www.google.co.il/"] ,  ["C","Callback Button","Template"] ) ,
                         Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"])
                         )

# send edited keyboard, its edit current inline keyboard and change buttons give deep navigation effect

Send.Edited_Inline_Keyboard(Bot_Variables,"Text Here",
                            Button.Inline(["u","URL Button","www.google.co.il"])
                            )


Send.Callback_Answer(Bot_Variables,"Callback Query Answer")

Send.Callback_Alert(Bot_Variables,"Callback Query Alert")

Send.Forword(Bot_Variables,from_chat_id,to_chat_id,message_id)


# send any file by file id , type : video/voice message/photo/document/sticker
Send.Any_File(Bot_Variables,file_id,caption)


--- Buttons Types ---

# regular markup button
Button.Markup("button text1","button text2")

# make button markup to send user location
Button.Markup_Location("button text")

# make button markup to send user phone number
Button.Markup_Phone("button text")

# regular inline button
Button.Inline( ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"])

#syntax:

* each time activated gives 1 rows of buttons


#Markup synatx
Send.Keyboard(Bot_Variables, "Text Here",
                  Button.Markup("button 1"),
                  Button.Markup(Button.Markup_Location("Send_Location")),
                  Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6"))


#Inline synatx
#NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax:
# ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]
# the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction)

Send.Inline_Keyboard(Bot_Variables, "Text Here" ,
                         Button.Inline(  ["U","URL Button","https://www.google.co.il/"] ,  ["C","Callback Button","Template"] ) ,
                         Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"])
                         )

    """
    Chat_ID = Bot_Variables[1]
    Users = Bot_Variables[10][0]

    user = Users.find_one({"chat_id": Chat_ID})

    chapter = int(user["book"]["bookmark"])
    book_chapters = user["book"]["chapters"]
    is_read_chapters = len(user["book"]["chapters"])
    write_type = user["write_type"]

    if is_read_chapters == 0:
        Users.update_one({"chat_id": Chat_ID}, {"$set": {"book.bookmark": 0}})

        Send.Inline_Keyboard(
            Bot_Variables, Send_Book.Func(0, Bot_Variables),
            Button.Inline([
                "C", "⬅️",
                rolling_left.Func(chapter, book_chapters, write_type)
            ], ["C", favoriets_name.Func(update, context), "Favorite"], [
                "C", "➡️",
                rolling_right.Func(chapter, book_chapters, write_type)
            ]),
            Button.Inline(["C",
                           is_read_name.Func(update, context), "is_read"]))
    else:
        Send.Inline_Keyboard(
            Bot_Variables,
            "כבר התחלת לקרוא כמה פרקים בתהילים מה ברצונך לעשות?",
            Button.Inline(["C", "🔵 להמשיך מאיפה שהפסקת 🔵", "start_bookmark"]),
            Button.Inline(["C", "♻️ לקרוא מחדש ♻️", "start_over"]))
Example #4
0
def Your_Code(update, context):
    """
    ---- imports ----

    from Program.Send import Send as Send

    from Program.Button import Button as Button

    import Program.Get_Bot_Variables as Get_Bot_Variables

    import threading

    """

    Bot_Variables = Get_Bot_Variables.Func([update, context])

    # - Variables - #
    """
    TOKEN = Bot_Variables[0]
    Chat_ID = Bot_Variables[1]
    First_Name = Bot_Variables[2]
    UserName = Bot_Variables[3]
    Message = Bot_Variables[4]
    Message_ID = Bot_Variables[5]
    File_ID = Bot_Variables[6]
    Virtual_Location = Bot_Variables[7]
    User_Privileges = Bot_Variables[8]
    User_Lang = Bot_Variables[9]
    Mongo_Collections = Bot_Variables[10]
    Json_Message = Bot_Variables[11]
    Update = Bot_Variables[12]
    Other_Variables = Bot_Variables[13]
    Context = Bot_Variables[14]
    
    """
    """
    --- Send Class ---


Send.Message(Bot_Variables,"Paste Text Here")

Send.Keyboard(Bot_Variables, "Text Here",
                  Button.Markup("button 1"),
                  Button.Markup(Button.Markup_Location("Send_Location")),
                  Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6"))



#NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax:
# ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]
# the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction)

Send.Inline_Keyboard(Bot_Variables, "Text Here" ,
                         Button.Inline(  ["U","URL Button","https://www.google.co.il/"] ,  ["C","Callback Button","Template"] ) ,
                         Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"])
                         )

# send edited keyboard, its edit current inline keyboard and change buttons give deep navigation effect

Send.Edited_Inline_Keyboard(Bot_Variables,"Text Here",
                            Button.Inline(["u","URL Button","www.google.co.il"])
                            )


Send.Callback_Answer(Bot_Variables,"Callback Query Answer")

Send.Callback_Alert(Bot_Variables,"Callback Query Alert")

Send.Forword(Bot_Variables,from_chat_id,to_chat_id,message_id)


# send any file by file id , type : video/voice message/photo/document/sticker
Send.Any_File(Bot_Variables,file_id,caption)


--- Buttons Types ---

# regular markup button
Button.Markup("button text1","button text2")

# make button markup to send user location
Button.Markup_Location("button text")

# make button markup to send user phone number
Button.Markup_Phone("button text")

# regular inline button
Button.Inline( ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"])

#syntax:

* each time activated gives 1 rows of buttons


#Markup synatx
Send.Keyboard(Bot_Variables, "Text Here",
                  Button.Markup("button 1"),
                  Button.Markup(Button.Markup_Location("Send_Location")),
                  Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6"))


#Inline synatx
#NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax:
# ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]
# the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction)

Send.Inline_Keyboard(Bot_Variables, "Text Here" ,
                         Button.Inline(  ["U","URL Button","https://www.google.co.il/"] ,  ["C","Callback Button","Template"] ) ,
                         Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"])
                         )

    """

    Chat_ID = Bot_Variables[1]
    Users = Bot_Variables[10][0]

    user = Users.find_one({"chat_id": Chat_ID})

    chapter = int(user["book"]["bookmark"])
    book_chapters = user["book"]["chapters"]
    write_type = user["write_type"]

    if chapter not in book_chapters:
        book_chapters.append(chapter)

        Users.update_one({"chat_id": Chat_ID},
                         {"$set": {
                             "book.chapters": book_chapters
                         }})

        Send.Callback_Answer(
            Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" +
            str(chapter + 1) + ")" + " סומן כנקרא ✅")
        if chapter < 149:
            Users.update_one({"chat_id": Chat_ID},
                             {"$set": {
                                 "book.bookmark": chapter + 1
                             }})
            Send.Edited_Inline_Keyboard(
                Bot_Variables, Send_Book.Func(chapter + 1, Bot_Variables),
                Button.Inline([
                    "C", "⬅️",
                    rolling_left.Func(chapter, book_chapters, write_type)
                ], ["C", favoriets_name.Func(update, context), "Favorite"], [
                    "C", "➡️",
                    rolling_right.Func(chapter, book_chapters, write_type)
                ]),
                Button.Inline(
                    ["C", is_read_name.Func(update, context), "is_read"]))

            try:
                chapter_count = Users.find_one(
                    {"chat_id": Chat_ID})["stats_chapters"][str(chapter)]
            except:
                chapter_count = 0
            Users.update_one({"chat_id": Chat_ID}, {
                "$set": {
                    "stats_chapters." + str(chapter): int(chapter_count) + 1
                }
            })
        else:
            try:
                chapter_count = Users.find_one(
                    {"chat_id": Chat_ID})["stats_chapters"][str(chapter)]
            except:
                chapter_count = 0
            Users.update_one({"chat_id": Chat_ID}, {
                "$set": {
                    "stats_chapters." + str(chapter): int(chapter_count) + 1
                }
            })
            #Users.update_one({"chat_id": Chat_ID}, {"$set": {"book.bookmark": chapter+1}})
            Send.Edited_Inline_Keyboard(
                Bot_Variables, Send_Book.Func(chapter, Bot_Variables),
                Button.Inline([
                    "C", "⬅️",
                    rolling_left.Func(chapter, book_chapters, write_type)
                ], ["C", favoriets_name.Func(update, context), "Favorite"], [
                    "C", "➡️",
                    rolling_right.Func(chapter, book_chapters, write_type)
                ]),
                Button.Inline(
                    ["C", is_read_name.Func(update, context), "is_read"]))

    else:

        book_chapters.remove(chapter)
        Users.update_one({"chat_id": Chat_ID},
                         {"$set": {
                             "book.chapters": book_chapters
                         }})
        Send.Callback_Answer(
            Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" +
            str(chapter + 1) + ")" + " סומן כלא נקרא 🚫")

        chapter_count = Users.find_one({"chat_id": Chat_ID})["stats_chapters"]
        chapter_count = chapter_count[str(chapter)] - 1

        Users.update_one(
            {"chat_id": Chat_ID},
            {"$set": {
                "stats_chapters." + str(chapter): chapter_count
            }})

        Send.Edited_Inline_Keyboard(
            Bot_Variables, Send_Book.Func(chapter, Bot_Variables),
            Button.Inline([
                "C", "⬅️",
                rolling_left.Func(chapter, book_chapters, write_type)
            ], ["C", favoriets_name.Func(update, context), "Favorite"], [
                "C", "➡️",
                rolling_right.Func(chapter, book_chapters, write_type)
            ]),
            Button.Inline(["C",
                           is_read_name.Func(update, context), "is_read"]))

    if len(book_chapters) > 149:
        Users.update_one({"chat_id": Chat_ID}, {"$set": {"book.chapters": []}})

        Send.Message(
            Bot_Variables,
            "ברכותינו‼️ סיימתם את ספר התהילים בהצלחה ❗️💚📖📖 התווספה נקודה לסטטיסטיקה האישית שלכם!💚🥳🥳😇😇😇"
        )