diff options
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -1,5 +1,22 @@ | |||
1 | # https://docs.python.org/3/library/configparser.html | 1 | # https://docs.python.org/3/library/configparser.html |
2 | 2 | ||
3 | from telegram import __version__ as TG_VER | ||
4 | |||
5 | try: | ||
6 | from telegram import __version_info__ | ||
7 | except ImportError: | ||
8 | __version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment] | ||
9 | |||
10 | if __version_info__ < (20, 0, 0, "alpha", 1): | ||
11 | raise RuntimeError( | ||
12 | f"This example is not compatible with your current PTB version {TG_VER}. To view the " | ||
13 | f"{TG_VER} version of this example, " | ||
14 | f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html" | ||
15 | ) | ||
16 | |||
17 | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, KeyboardButton | ||
18 | from prompt.string import * | ||
19 | from typing import TypedDict | ||
3 | import configparser | 20 | import configparser |
4 | 21 | ||
5 | config = configparser.ConfigParser() | 22 | config = configparser.ConfigParser() |
@@ -14,3 +31,22 @@ TOOT_CLIENT_SECRET = config["TOOT"]["CLIENT_SECRET"] | |||
14 | TOOT_ACCESS_TOKEN = config["TOOT"]["ACCESS_TOKEN"] | 31 | TOOT_ACCESS_TOKEN = config["TOOT"]["ACCESS_TOKEN"] |
15 | 32 | ||
16 | MEDIA_GROUP_TIMEOUT = 3 | 33 | MEDIA_GROUP_TIMEOUT = 3 |
34 | |||
35 | WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, ADD_MEDIA, ADD_COMMENT = range(5) | ||
36 | |||
37 | MAIN_MENU = ReplyKeyboardMarkup([ | ||
38 | [KeyboardButton(text="Check-in here", request_location=True)], | ||
39 | ]) | ||
40 | |||
41 | SKIP_LOCATION_SEARCH = CALLBACK_SKIP | ||
42 | INLINE_SKIP_MENU = InlineKeyboardMarkup([ | ||
43 | [InlineKeyboardButton("Skip", callback_data=SKIP_LOCATION_SEARCH)] | ||
44 | ]) | ||
45 | |||
46 | |||
47 | class MsgDict(TypedDict): | ||
48 | media_id: str | ||
49 | caption: str | ||
50 | status_id: int | ||
51 | content: str | ||
52 | chat_id: int | ||