コード例 #1
0
def enable_photos(bot, update):
    chat_id = get_chat_id(update)
    TBDB.set_chat_photos_enabled(chat_id, 1)
    bot.send_message(chat_id=chat_id,
                     text=R.get_string_resource("photos_enabled",
                                                TBDB.get_chat_lang(chat_id)),
                     is_group=chat_id < 0)
コード例 #2
0
def test_db():
    id = 1234

    TBDB.create_default_chat_entry(id, 'en-US')
    assert TBDB.get_chat_lang(id) == 'en-US'
    assert TBDB.get_chat_active(id) == 1

    TBDB.set_chat_lang(id, 'lang')
    TBDB.set_chat_voice_enabled(id, 2)
    TBDB.set_chat_photos_enabled(id, 1)
    TBDB.set_chat_qr_enabled(id, 1)
    TBDB.set_chat_active(id, 0)
    TBDB.set_chat_ban(id, 1)

    assert TBDB.get_chat_lang(id) == 'lang'
    assert TBDB.get_chat_voice_enabled(id) == 2
    assert TBDB.get_chat_photos_enabled(id) == 1
    assert TBDB.get_chat_qr_enabled(id) == 1
    assert TBDB.get_chat_active(id) == 0
    assert TBDB.get_chat_ban(id) == 1