Пример #1
0
def pressed(update, context):
    global settingList
    global conn

    connection.save_settings(conn, update.callback_query.message.chat.id,
                             str(update.callback_query.message.chat.title),
                             update.callback_query.message.chat.type,
                             str(update.callback_query.message.chat.username),
                             update.callback_query.data)
    settingList = connection.read_turnedon_notif(conn)
    update.callback_query.edit_message_reply_markup(
        reply_markup=buttonQuery(update, context))
Пример #2
0
def settingsPressed(update, context):
    global settingList
    global conn

    if update.callback_query.data == 'close':
        update.callback_query.edit_message_text('Settings Closed')
    else:
        connection.save_settings(
            conn, update.callback_query.message.chat.id,
            str(update.callback_query.message.chat.title),
            update.callback_query.message.chat.type,
            str(update.callback_query.message.chat.username),
            update.callback_query.data)
        settingList = connection.read_turnedon_notif(conn)
        markup = settingsQuery(update, context)
        update.callback_query.edit_message_reply_markup(reply_markup=markup)
Пример #3
0
def updateCounter(conn):
    '''
    result will be COUNTERPROVINCE = [prov_id {'positif': value, 'sembuh':...}]
    '''
    #counter = 0
    global TURNEDONNOTIF
    global PREFERENCES
    global COUNTERPROVINCE
    global UPDATEPROVINCE
    global listprov
    PREFERENCES = connection.read_turnedon_notif(conn)
    for prov_id in PREFERENCES:
        TURNEDONNOTIF.append(prov_id[1])
    TURNEDONNOTIF = list(set(TURNEDONNOTIF))
    #getUpdate('provinsi')
    with open('provinsi.json') as file:
        old = [i for i in json.load(file)]
    '''for notif in TURNEDONNOTIF:
        for counter,dataOld in enumerate(old):
            if (dataOld['attributes']['Kode_Provi'] == notif and UPDATEPROVINCE[counter]['attributes']['Kode_Provi'] == notif):
                COUNTERPROVINCE[notif] = {'positif': UPDATEPROVINCE[counter]['attributes']['Kasus_Posi'] - dataOld['attributes']['Kasus_Posi'], 'sembuh': UPDATEPROVINCE[counter]['attributes']['Kasus_Semb'] - dataOld['attributes']['Kasus_Semb'], 'meninggal': UPDATEPROVINCE[counter]['attributes']['Kasus_Meni'] - dataOld['attributes']['Kasus_Meni']}
                tofile('provinsi')'''
    for idprov in listprov:
        for counter, dataOld in enumerate(old):
            if (dataOld['attributes']['Kode_Provi'] == idprov
                    and UPDATEPROVINCE[counter]['attributes']['Kode_Provi']
                    == idprov):
                COUNTERPROVINCE[idprov] = {
                    'positif':
                    UPDATEPROVINCE[counter]['attributes']['Kasus_Posi'] -
                    dataOld['attributes']['Kasus_Posi'],
                    'sembuh':
                    UPDATEPROVINCE[counter]['attributes']['Kasus_Semb'] -
                    dataOld['attributes']['Kasus_Semb'],
                    'meninggal':
                    UPDATEPROVINCE[counter]['attributes']['Kasus_Meni'] -
                    dataOld['attributes']['Kasus_Meni']
                }
                tofile('provinsi')
Пример #4
0
    "Sumatera Selatan": 16,
    "Kep. Riau": 21,
    "Riau": 14,
    "Aceh": 11,
    "Bengkulu": 17,
    "Belitung": 19,
    "Lampung": 18,
    "Jambi": 15,
    "NTB": 52,
    "Maluku": 81,
    "Maluku Utara": 82,
    "Papua": 94,
    "Papua Barat": 91,
    "Close Menu": "close"
}
settingList = connection.read_turnedon_notif(conn)


def manualPage(file):
    '''
    pass the /path/file.txt
    '''
    with open(file, 'r') as banner:
        return banner.read()


def send_action(action):
    '''
    send action while processing func command
    '''
    def decorator(func):