def hebrew_school_year_printable(self): """Returns the text of the year as usually written, without the ה at the start""" return int_to_gematria(self.hebrew_school_year - 5000)
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/"]) ) """ Users = Bot_Variables[10][0] Chat_ID = Bot_Variables[1] favirites = Users.find_one({"chat_id":Chat_ID})["favorites"] Inline_Keyboard = {'inline_keyboard': []} Buttons = [] bot_name = telegram.Bot(Bot_Variables[0]).get_me().username for i in range(int(len(favirites))): link = "https://t.me/" +bot_name +"?start=T{}" url = link.format(str(favirites[i])) Buttons.append( [{'text': int_to_gematria(favirites[i]+1), 'url':url}]) Json_Message = Bot_Variables[11] Inline_Keyboard = {'inline_keyboard': [ ]} for i in range(len(Buttons)): Inline_Keyboard["inline_keyboard"].append(Buttons[i]) Json_Message.reply_text("פרקים מועדפים ⭐️",reply_markup=Inline_Keyboard)
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"]) favorites = user["favorites"] book_chapters = user["book"]["chapters"] write_type = user["write_type"] if chapter not in favorites: favorites.append(chapter) Users.update_one({"chat_id": Chat_ID}, {"$set": { "favorites": favorites }}) Send.Callback_Answer( Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" + str(chapter + 1) + ")" + " נוסף למועדפים ✅") Send.Edited_Inline_Keyboard( Bot_Variables, send_neshama.Func(chapter, Bot_Variables), Button.Inline(["C", "⬅️", rolling_left.Func(write_type)], [ "C", favoriets_name.Func(update, context), "Favorite_neshama" ], ["C", "➡️", rolling_right.Func(write_type)]), Button.Inline( ["C", is_read_name.Func(update, context), "is_read_neshama"])) else: favorites.remove(chapter) Users.update_one({"chat_id": Chat_ID}, {"$set": { "favorites": favorites }}) Send.Callback_Answer( Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" + str(chapter + 1) + ")" + " הוסר ממועדפים 🚫") Send.Edited_Inline_Keyboard( Bot_Variables, send_neshama.Func(chapter, Bot_Variables), Button.Inline(["C", "⬅️", rolling_left.Func(write_type)], [ "C", favoriets_name.Func(update, context), "Favorite_neshama" ], ["C", "➡️", rolling_right.Func(write_type)]), Button.Inline( ["C", is_read_name.Func(update, context), "is_read_neshama"]))
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["random_chapter"]) button = update['callback_query']["message"]["reply_markup"][ 'inline_keyboard'][1][0]["text"] if button == "🔴 סמן כנקרא 🔴": 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 } }) Send.Callback_Answer( Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" + str(chapter + 1) + ")" + " סומן כנקרא ✅") Send.Edited_Inline_Keyboard( Bot_Variables, Send_Book.Func(chapter, Bot_Variables), Button.Inline([ "C", favoriets_name.Func(update, context), "add_random_chapter_to_favoeites" ]), Button.Inline(["C", "✅ נקרא ✅", "mark_random_as_read"])) else: chapter_count = Users.find_one({"chat_id": Chat_ID})["stats_chapters"] chapter_count = chapter_count[str(chapter)] - 1 Send.Callback_Answer( Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" + 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", favoriets_name.Func(update, context), "add_random_chapter_to_favoeites" ]), Button.Inline(["C", "🔴 סמן כנקרא 🔴", "mark_random_as_read"]))
def format(self, date): date = date.dict() date['month'] = hebrewcal.Month(date['year'], date['month']).name year_name = (int_to_gematria(int(str(date['year'])[0])) + int_to_gematria(int(str(date['year'])[1:]))) return f"{int_to_gematria(date['day'])} {date['month']} {year_name[::-1]}"
def parse(infile, outfile): needtowrite = 0 stringtowrite = '' dbname = infile[13:-4] ot = 0 book_num = int(dbname[:2 - len(dbname)]) if book_num is not 35: printas = dbname[2:3 - len(dbname)] book = books[book_num] if dbname[2:3 - len(dbname)] is 'a': book = book + ' א' ot = 1 if dbname[2:3 - len(dbname)] is 'b': book = book + ' ב' ot = 1 else: ot = 1 if dbname[2:3 - len(dbname)] is 'a': book = 'עזרא' else: book = 'נחמיה' perek = int(dbname[2 + ot:]) perek_ot = int_to_gematria(perek, '') book = book + ' ' + perek_ot + '.txt' songstable = [] linestable = [] if os.path.isfile(book): perek_file = open(book) html = 0 body = 0 for line in perek_file: cols = line.split(' : ') songstable.append(cols[1][:-1]) linestable.append(cols[0]) fin = open(infile, errors='ignore') fout = open(outfile, "w+") for line in fin: if line.__contains__('Windows-1255'): line = line.replace('Windows-1255', 'utf-8') if line.__contains__( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' ): line = '<!DOCTYPE HTML>' if line.__contains__('<P>'): line = line.replace('<P>', '') if line.__contains__('</html>') and html == 1: line = '' if line.__contains__('</body>') and body == 1: line = '' if line.__contains__('</html>'): html = 1 if line.__contains__('</body>'): html = 1 if needtowrite == 1: line = line + stringtowrite needtowrite = 0 stringtowrite = '' fout.write(line) continue if line.__contains__('Copyright'): line = '' if line.__contains__('<A NAME="'): if line[10:11 - len(line)] is '"': pasuk_num = line[9:10 - len(line)] else: pasuk_num = line[9:11 - len(line)] if pasuk_num not in linestable: line = '</p><p>' + line else: lines = [i for i, x in enumerate(linestable) if x == pasuk_num] line = line + '</p><p><em id="pasuk-' + pasuk_num + '" class="selected-text selected">' needtowrite = 1 stringtowrite = ' </em><div id="popup' + pasuk_num + '" style="display: none"><div id="close' + pasuk_num + '" class="modal-content"><div class="modal-header"><span id="close-' + pasuk_num + '" class="close" inline="display">×</span>' for i in lines: song_no_spaces = songstable[i].split(' ') song_link = '' for sns in song_no_spaces: song_link = song_link + sns stringtowrite = stringtowrite + '<A HREF="' + song_link + '.html" class="button">' + songstable[ i] + '</A><br>' stringtowrite = stringtowrite[:-4] + '</div></div></div>' fout.write(line) endstring = '<script>\n' for l in linestable: endstring = endstring + 'var p' + l + 'open = document.getElementById(\'pasuk-' + l + '\');\nvar p' + l + 'close = document.getElementById("close-' + l + '");\np' + l + 'open.onclick = function() {\ndocument.getElementById(\'popup' + l + '\').style.display = \'block\';\n}\np' + l + 'close.onclick=function(){\ndocument.getElementById(\'popup' + l + '\').style.display = "none";\n}\n' endstring = endstring + '</script>' fout.write(endstring) fin.close() fout.close() copy(outfile, infile)
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, "ברכותינו‼️ סיימתם את ספר התהילים בהצלחה ❗️💚📖📖 התווספה נקודה לסטטיסטיקה האישית שלכם!💚🥳🥳😇😇😇" )
import pywikibot import logging import time from hebrew_numbers import int_to_gematria from contextlib import contextmanager import datetime import os from collections import defaultdict ALBUMS_URL = 'http://info.palmach.org.il/show_item.asp?levelId=38530' IMAGE_LIST_URL = 'http://info.palmach.org.il/show_item.asp?levelId=38530&itemId=6342&itemType=0' IMAGE_DETAILS_BASE_URL = 'http://info.palmach.org.il/' IMAGE_ID_REGEX = 'show_item.asp\?levelId=(\d*)&itemId=(\d*)&itemType=(\d*)&obj=(\d*)&picI=(\d*)' IMAGE_HIGH_RES_URL = 'http://palmach.org.il/Uploads/ArchivePictures/{0}/P_{0}_0.jpg' HEB_YEARS = { year: int_to_gematria(year - 1239).replace('״', '"') for year in range(1900, 1948) } DESCRIPTION_TEMPLATE = """=={{int:filedesc}}== {{Information |description={{he|1=__DESCRIPTION__}} |date=__YEAR__ |source={{he|1=__SOURCE__}} |author={{he|1=__AUTHOR__}} |permission= |other versions= |other fields={{Information field|Name=Palmah Collection Identifier|Value=__PIC_ID__}} }} =={{int:license-header}}== {{PD-Israel}} {{Supported by Wikimedia Israel|year=2018}}
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/"]) ) """ 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] Json_Message = Bot_Variables[11] Update = Bot_Variables[12] Other_Variables = Bot_Variables[13] Context = Bot_Variables[14] Names = Bot_Variables[10][2] Users = Bot_Variables[10][0] user = Users.find_one({"chat_id": Chat_ID}) men_name = user["read for name"]["name"][0] chapter = user["read for name"]["name"][1] chat = user["read for name"]["chat"] chapters = Names.find_one({ "chat_id": chat, "name": men_name })["chapters_stats"] if (not chapter in chapters): chapters.append(chapter) Names.update_one({ "chat_id": chat, "name": men_name }, {"$set": { "chapters_stats": chapters }}) Send.Callback_Alert( Bot_Variables, "פרק " + str(int_to_gematria(chapter + 1)) + " (" + str(chapter + 1) + ")" + " סומן כנקרא ✅") to = Names.find_one({"chat_id": chat, "name": men_name})["for"] llist = [chapter, len(chapters), men_name, to, Bot_Variables] t = SSend_chapter.Func(llist) next = Names.find_one({"chat_id": chat, "name": men_name})["link"] Send.Edited_Inline_Keyboard(Bot_Variables, t, Button.Inline(["u", "➕ פרק נוסף ➕️", next]))