aboutsummaryrefslogblamecommitdiff
blob: bff9313add1bd202748b461bf2d45b9517812ebc (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                                                                                                    
                   
 

                                    
 

                                                     
                                              
 





                                                                  
                       
 




                                                                    


                                                                  
                                  

  




                                    











                                                                      



                                               
                                           
 




                                                                               
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"]
ENCRYPT_KEY = config["DEFAULT"]["ENCRYPT_KEY"]

TELEGRAM_WEBHOOK_URL = config["API"]["TELEGRAM_WEBHOOK_URL"]
HEALTHCHECK_URL = config["API"]["HEALTHCHECK_URL"]
FEDI_LOGIN_CALLBACK_URL = config["API"]["FEDI_LOGIN_CALLBACK_URL"]
BOT_DOMAIN = config["API"]["BOT_DOMAIN"]
BOT_PORT = int(config["API"]["BOT_PORT"])

MEDIA_GROUP_TIMEOUT = 3

FEDI_LOGIN, \
    WAIT_VISIBILITY, \
    DELAYED_CHECKIN, \
    WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, \
    ADD_MEDIA, ADD_COMMENT = range(8)

MAIN_MENU = ReplyKeyboardMarkup([
    [KeyboardButton(text="Check-in here", request_location=True)],
    [KeyboardButton(text="/Help")]
])

LOGIN_MENU = ReplyKeyboardMarkup([
    [KeyboardButton(text="/login")],
    [KeyboardButton(text="/Help")]
])

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"
KEY_IS_SCHEDULED_TOOT = "is_scheduled_toot"

# TODO:
# use the first scope as default
# if user set delayed post, ask user consent and request OAuth token again
# DEFAULT_BOT_SCOPE = ['read:accounts', 'write:media', 'write:statuses']
BOT_SCOPE = ['read:accounts', 'read:statuses', 'write:media', 'write:statuses']
Powered by cgit v1.2.3 (git 2.41.0)