blob: 9e72598680ec7dfa6f97c9334c0dee48e5dd73b5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# https://docs.python.org/3/library/configparser.html
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, KeyboardButton
from prompt.string import *
from typing import TypedDict
import configparser
config = configparser.ConfigParser()
config.read("config.ini")
BOT_TOKEN = config["DEFAULT"]["BOT_TOKEN"]
FSQ_API_KEY = config["DEFAULT"]["FOURSQUARE_API_KEY"]
TOOT_API_BASE_URL = config["TOOT"]["API_BASE_URL"]
TOOT_CLIENT_ID = config["TOOT"]["CLIENT_ID"]
TOOT_CLIENT_SECRET = config["TOOT"]["CLIENT_SECRET"]
TOOT_ACCESS_TOKEN = config["TOOT"]["ACCESS_TOKEN"]
MEDIA_GROUP_TIMEOUT = 3
FEDI_LOGIN, WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, ADD_MEDIA, ADD_COMMENT = range(6)
MAIN_MENU = ReplyKeyboardMarkup([
[KeyboardButton(text="Check-in here", request_location=True)],
])
SKIP_LOCATION_SEARCH = CALLBACK_SKIP
INLINE_SKIP_MENU = InlineKeyboardMarkup([
[InlineKeyboardButton("Skip", callback_data=SKIP_LOCATION_SEARCH)]
])
class MsgDict(TypedDict):
media_id: str
caption: str
status_id: int
content: str
chat_id: int
KEY_TOOT_STATUS_ID = "toot_status_id"
KEY_TOOT_STATUS_CONTENT = "toot_status_content"
MASTODON_CLIENT_ID_FILE = "mastodon.client_id"
TELEGRAM_WEBHOOK_URL = "/checkinbot/webhook"
HEALTHCHECK_URL = "/checkinbot/healthcheck"
FEDI_LOGIN_CALLBACK_URL = "/checkinbot/fedi_login_callback"
BOT_DOMAIN = "https://zjw.social"
BOT_PORT = 30010
BOT_SCOPE = ['read:accounts', 'write:media', 'write:statuses']
|