コード例 #1
0
def infoPages(colore: str, categoria: str, page: int = 0, totPages: int = 1):
    # Una pagina
    if totPages == 1:
        return InlineKeyboardMarkup(inline_keyboard=[[
            InlineKeyboardButton(text="↩️ Menù",
                                 callback_data="infoColore#{}".format(colore))
        ]])
    # Più pagine, prima pagina
    elif page == 0:
        return InlineKeyboardMarkup(
            inline_keyboard=[[
                InlineKeyboardButton(text="➡️ Avanti",
                                     callback_data="catInfo#{}#{}#{}".format(
                                         colore, categoria, page + 1))
            ],
                             [
                                 InlineKeyboardButton(
                                     text="↩️ Menù",
                                     callback_data="infoColore#{}".format(
                                         colore))
                             ]])
    # Più pagine, ultima pagina
    elif (page + 1) == totPages:
        return InlineKeyboardMarkup(
            inline_keyboard=[[
                InlineKeyboardButton(text="⬅️ Indietro",
                                     callback_data="catInfo#{}#{}#{}".format(
                                         colore, categoria, page - 1))
            ],
                             [
                                 InlineKeyboardButton(
                                     text="↩️ Menù",
                                     callback_data="infoColore#{}".format(
                                         colore))
                             ]])
    # Più pagine, in mezzo
    else:
        return InlineKeyboardMarkup(inline_keyboard=[
            [
                InlineKeyboardButton(text="⬅️ Indietro",
                                     callback_data="catInfo#{}#{}#{}".format(
                                         colore, categoria, page - 1)),
                InlineKeyboardButton(text="➡️ Avanti",
                                     callback_data="catInfo#{}#{}#{}".format(
                                         colore, categoria, page + 1))
            ],
            [
                InlineKeyboardButton(text="↩️ Menù",
                                     callback_data="infoColore#{}".format(
                                         colore))
            ]
        ])
コード例 #2
0
def create_memo(today: int):
    days = [
        "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato",
        "Domenica"
    ]
    keyboard = [[
        InlineKeyboardButton(text="Domani", callback_data=f"memo_p1"),
        InlineKeyboardButton(text=days[(today + 2) % 7],
                             callback_data=f"memo_p2"),
        InlineKeyboardButton(text=days[(today + 3) % 7],
                             callback_data=f"memo_p3")
    ],
                [
                    InlineKeyboardButton(text=days[(today + 4) % 7],
                                         callback_data=f"memo_p4"),
                    InlineKeyboardButton(text=days[(today + 5) % 7],
                                         callback_data=f"memo_p5"),
                    InlineKeyboardButton(text=days[(today + 6) % 7],
                                         callback_data=f"memo_p6"),
                    InlineKeyboardButton(text=days[(today + 7) % 7] +
                                         " pross.",
                                         callback_data=f"memo_p7")
                ]]

    return InlineKeyboardMarkup(inline_keyboard=keyboard)
コード例 #3
0
def settings_team():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="🔧 Cambia",
                             callback_data="settings_changeTeam"),
        InlineKeyboardButton(text="❌ Rimuovi",
                             callback_data="settings_removeTeam")
    ]])
コード例 #4
0
def infoColorePvt(colore: str):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(
            text="ℹ️ Maggiori informazioni",
            url="tg://resolve?domain=checolorebot&start=info_{}".format(
                colore))
    ]])
コード例 #5
0
def settings_donotdisturb(active: bool = True):
    choices = {True: ["🔔 Suona", "no"], False: ["😴 Attiva", "yes"]}
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(
            text=choices[active][0],
            callback_data=f"settings_night_{choices[active][1]}"),
        InlineKeyboardButton(text="◀️ Indietro", callback_data="settings_main")
    ]])
コード例 #6
0
def delete_confirm(clip_id, msg_id):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="✅ Yes",
                             callback_data="deleteyes_{}#{}".format(
                                 clip_id, msg_id)),
        InlineKeyboardButton(text="🔴 No!",
                             callback_data="deleteno#{}".format(msg_id)),
    ]])
コード例 #7
0
def notifiche():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="🔔 Attiva", callback_data="notifToggle#on"),
        InlineKeyboardButton(text="🔕 Disattiva",
                             callback_data="notifToggle#off")
    ], [
        InlineKeyboardButton(text="✅ Fatto", callback_data="notifToggle#done")
    ]])
コード例 #8
0
def settings_notifications(active: bool = True):
    choices = {True: ["🔕 Disattiva", "no"], False: ["🔔 Attiva", "yes"]}
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(
            text=choices[active][0],
            callback_data=f"settings_notif_{choices[active][1]}"),
        InlineKeyboardButton(text="◀️ Indietro", callback_data="settings_main")
    ]])
コード例 #9
0
def pressF(count: int=0):
    if count == 0:
        txt = "Press F"
    elif count == 1:
        txt = "1 F in Chat"
    else:
        txt = f"{count} F's"
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text=txt, callback_data=f"pressf#{count}")
    ]])
コード例 #10
0
def settings_selectnews():
    return InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text="⏰ Gara iniziata",
                                 callback_data="news_eventStart")
        ],
        [
            InlineKeyboardButton(text="📊 Classifica",
                                 callback_data="news_rankChanged"),
            InlineKeyboardButton(text="📈 Punti",
                                 callback_data="news_pointsChanged")
        ]
    ])
コード例 #11
0
def regions():
    keyboard = []
    line = []
    for name in regionList:
        line.append(
            InlineKeyboardButton(text=name,
                                 callback_data="setregion#{}".format(name)))
        if len(line) == 2:
            keyboard.append(line.copy())
            line.clear()
    if len(line) > 0:
        keyboard.append(line.copy())
        line.clear()
    return InlineKeyboardMarkup(inline_keyboard=keyboard)
コード例 #12
0
def leaderboard(page: int, maxTeams: int):
    maxPages = ceil(maxTeams / 10)
    if page == 1:
        return InlineKeyboardMarkup(inline_keyboard=[[
            InlineKeyboardButton(text="Next ▶️",
                                 callback_data="leaderboard_page#{}".format(
                                     page + 1))
        ]])
    elif page == maxPages:
        return InlineKeyboardMarkup(inline_keyboard=[[
            InlineKeyboardButton(text="◀️ Back",
                                 callback_data="leaderboard_page#{}".format(
                                     page - 1))
        ]])
    else:
        return InlineKeyboardMarkup(inline_keyboard=[[
            InlineKeyboardButton(text="◀️ Back",
                                 callback_data="leaderboard_page#{}".format(
                                     page - 1)),
            InlineKeyboardButton(text="Next ▶️",
                                 callback_data="leaderboard_page#{}".format(
                                     page + 1))
        ]])
コード例 #13
0
def categorieInfo(colore: str, page: int = 0):
    return InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text="🍽 Attività Commerciali",
                                 callback_data="catInfo#{}#attcom#{}".format(
                                     colore, page))
        ],
        [
            InlineKeyboardButton(text="🖥 Attività Professionali",
                                 callback_data="catInfo#{}#attpro#{}".format(
                                     colore, page)),
        ],
        [
            InlineKeyboardButton(text="⚽️ Attività Sportive",
                                 callback_data="catInfo#{}#attsport#{}".format(
                                     colore, page)),
        ],
        [
            InlineKeyboardButton(text="👥 Eventi / Riunioni",
                                 callback_data="catInfo#{}#eventi#{}".format(
                                     colore, page)),
        ],
        [
            InlineKeyboardButton(text="🏢 Uffici Pubblici",
                                 callback_data="catInfo#{}#uffici#{}".format(
                                     colore, page)),
        ],
        [
            InlineKeyboardButton(text="📄 Sanzioni",
                                 callback_data="catInfo#{}#sanzioni#{}".format(
                                     colore, page)),
            InlineKeyboardButton(text="🚗 Spostamenti",
                                 callback_data="catInfo#{}#sposta#{}".format(
                                     colore, page)),
        ],
        [
            InlineKeyboardButton(text="🎓 Università",
                                 callback_data="catInfo#{}#uni#{}".format(
                                     colore, page)),
            InlineKeyboardButton(text="👷 Lavoro",
                                 callback_data="catInfo#{}#lavoro#{}".format(
                                     colore, page)),
        ],
        [
            InlineKeyboardButton(
                text="😷 Mascherine",
                callback_data="catInfo#{}#mascherine#{}".format(colore, page)),
        ]
    ])
コード例 #14
0
def settings_menu():
    return InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text="📊 Cambia regione",
                                 callback_data="settings#regione")
        ],
        [
            InlineKeyboardButton(text="🔔 Attiva/Disattiva notifiche",
                                 callback_data="settings#notifiche")
        ],
        [
            InlineKeyboardButton(text="🕙 Orario notifiche",
                                 callback_data="settings#orario")
        ]
    ])
コード例 #15
0
def manageBooks(actionStr, msg_id, show_all=False):
    keyboard = []
    books = select(b for b in Book)[:]
    for book in sorted(books, key=lambda x: x.name):
        if show_all or (book.category.name == "General"):
            keyboard.append([
                InlineKeyboardButton(
                    text=book.name,
                    callback_data=f"{actionStr}book_{book.id}#{msg_id}")
            ])
    if not show_all:
        keyboard.append([
            InlineKeyboardButton(text="📚 Show All Books",
                                 callback_data=f"{actionStr}all#{msg_id}")
        ])
    return InlineKeyboardMarkup(inline_keyboard=keyboard)
コード例 #16
0
def settings_dailynotif(active: bool = True):
    choices = {True: ["🔕 Disattiva", "no"], False: ["🔔 Attiva", "yes"]}
    return InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text="🕙 -30 min.",
                                 callback_data="settings_daily_minus"),
            InlineKeyboardButton(text="🕙 +30 min.",
                                 callback_data="settings_daily_plus")
        ],
        [
            InlineKeyboardButton(
                text=choices[active][0],
                callback_data=f"settings_daily_{choices[active][1]}"),
            InlineKeyboardButton(text="◀️ Indietro",
                                 callback_data="settings_main")
        ]
    ])
コード例 #17
0
def search_cat(msg_id):
    keyboard = []
    line = []
    linecount = 0
    categories = select(c for c in Category if c.books)[:]
    for cat in sorted(categories, key=lambda x: x.name):
        linecount += 1
        if linecount > 2:
            linecount = 1
            keyboard.append(line)
            line = []
        line.append(
            InlineKeyboardButton(text=cat.name,
                                 callback_data=f"searchcat_{cat.id}#{msg_id}"))
    if line:
        keyboard.append(line)
    return InlineKeyboardMarkup(inline_keyboard=keyboard)
コード例 #18
0
def settings_selectnews():
    return InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text="📚 Didattica",
                                 callback_data="news_didattica"),
            InlineKeyboardButton(text="❗️ Note", callback_data="news_note")
        ],
        [
            InlineKeyboardButton(text="📝 Voti", callback_data="news_voti"),
            InlineKeyboardButton(text="📆 Agenda", callback_data="news_agenda")
        ],
        [
            InlineKeyboardButton(text="📩 Circolari",
                                 callback_data="news_circolari"),
            InlineKeyboardButton(text="◀️ Torna al menù",
                                 callback_data="settings_main")
        ]
    ])
コード例 #19
0
def delete(user, msg_id):
    from pony.orm import select
    from modules.database import Clip
    keyboard = []
    line = []
    linecount = 0
    for clip in select(c for c in Clip if c.user == user)[:]:
        linecount += 1
        if linecount > 2:
            linecount = 1
            keyboard.append(line)
            line = []
        line.append(
            InlineKeyboardButton(text=clip.title,
                                 callback_data="delclip_{}#{}".format(
                                     clip.id, msg_id)))
    if line:
        keyboard.append(line)
    return InlineKeyboardMarkup(inline_keyboard=keyboard)
コード例 #20
0
def settings_menu():
    return InlineKeyboardMarkup(inline_keyboard=[
        [
            InlineKeyboardButton(text="🔔 Ricevi notifiche",
                                 callback_data="settings_notifications"),
            InlineKeyboardButton(text="📲 Scegli notifiche",
                                 callback_data="settings_selectnews")
        ],
        [
            InlineKeyboardButton(text="😴 Mod. Non Disturbare",
                                 callback_data="settings_donotdisturb"),
            InlineKeyboardButton(text="🕑 Notifiche giornaliere",
                                 callback_data="settings_dailynotif")
        ],
        [
            InlineKeyboardButton(text="✔️ Chiudi",
                                 callback_data="settings_close")
        ]
    ])
コード例 #21
0
def settings_newteam():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="✅ Aggiungi",
                             callback_data="settings_changeTeam")
    ]])
コード例 #22
0
def infoColore(colore: str):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="ℹ️ Maggiori informazioni",
                             callback_data="infoColore#{}".format(colore))
    ]])
コード例 #23
0
ファイル: keyboards.py プロジェクト: CiccaGuru/overVoltBot
def prenota(domain, link_id):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="🏷 Prenota offerta",
                             callback_data="prenotaLink#{}#{}".format(
                                 domain, link_id))
    ]])
コード例 #24
0
def back_search(msg_id):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="◀️ Back",
                             callback_data=f"backsearch#{msg_id}")
    ]])
コード例 #25
0
def logout():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="✖️ Logout", callback_data="logout_yes"),
        InlineKeyboardButton(text="❌ Annulla", callback_data="logout_no")
    ]])
コード例 #26
0
def lezioni(day=0):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="⬅️ Prima",
                             callback_data=f"lezioni#{day-1}"),
        InlineKeyboardButton(text="Dopo ➡️", callback_data=f"lezioni#{day+1}")
    ]])
コード例 #27
0
def mod_orario():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="♻️ Modifica", callback_data="orario_mod"),
        InlineKeyboardButton(text="🗑 Elimina", callback_data="orario_del")
    ]])
コード例 #28
0
def settings_menu():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="👥 Team", callback_data="settings_team")
    ], [
        InlineKeyboardButton(text="📲 Notifiche", callback_data="settings_news")
    ]])
コード例 #29
0
ファイル: keyboards.py プロジェクト: CiccaGuru/overVoltBot
def open_scontino(domain, link_id):
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="➡️ Apri con Scontino",
                             url="tg://resolve?domain=Scontino_bot&start={}_{}"
                             .format(domain, link_id))
    ]])
コード例 #30
0
def back():
    return InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(text="◀️ Indietro", callback_data="settings_main")
    ]])