aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-21 23:32:21 -0800
committerclarkzjw <[email protected]>2023-02-21 23:32:21 -0800
commit3a76618d0f46c7e28641b74a869544661c504e21 (patch)
tree47af0b7b4dfe9ad5ad6f710c6efe9ab99ab35165 /config.py
parentefc952972f97f98814b2e9a49648766101cd0725 (diff)
downloadswarm2fediverse-3a76618d0f46c7e28641b74a869544661c504e21.tar.gz
refactoring code
Diffstat (limited to 'config.py')
-rw-r--r--config.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/config.py b/config.py
index 3356d11..b690401 100644
--- a/config.py
+++ b/config.py
@@ -1,5 +1,22 @@
1# https://docs.python.org/3/library/configparser.html 1# https://docs.python.org/3/library/configparser.html
2 2
3from telegram import __version__ as TG_VER
4
5try:
6 from telegram import __version_info__
7except ImportError:
8 __version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
9
10if __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
17from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, KeyboardButton
18from prompt.string import *
19from typing import TypedDict
3import configparser 20import configparser
4 21
5config = configparser.ConfigParser() 22config = configparser.ConfigParser()
@@ -14,3 +31,22 @@ TOOT_CLIENT_SECRET = config["TOOT"]["CLIENT_SECRET"]
14TOOT_ACCESS_TOKEN = config["TOOT"]["ACCESS_TOKEN"] 31TOOT_ACCESS_TOKEN = config["TOOT"]["ACCESS_TOKEN"]
15 32
16MEDIA_GROUP_TIMEOUT = 3 33MEDIA_GROUP_TIMEOUT = 3
34
35WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, ADD_MEDIA, ADD_COMMENT = range(5)
36
37MAIN_MENU = ReplyKeyboardMarkup([
38 [KeyboardButton(text="Check-in here", request_location=True)],
39])
40
41SKIP_LOCATION_SEARCH = CALLBACK_SKIP
42INLINE_SKIP_MENU = InlineKeyboardMarkup([
43 [InlineKeyboardButton("Skip", callback_data=SKIP_LOCATION_SEARCH)]
44])
45
46
47class MsgDict(TypedDict):
48 media_id: str
49 caption: str
50 status_id: int
51 content: str
52 chat_id: int
Powered by cgit v1.2.3 (git 2.41.0)