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
|
from config import *
from telegram import __version__ as TG_VER
from typing import cast, List
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, ReplyKeyboardMarkup, KeyboardButton
from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, MessageHandler, filters, \
ConversationHandler, CallbackContext
from telegram.constants import ParseMode, ChatAction
from telegram.error import BadRequest
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove
async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
hello = "Hello, this is `checkin.bot`. \n\n" \
"This is a Telegram bot with functionality similar to Foursquare Swarm, " \
"but check in and post your location to the Fediverse (Mastodon/Pleroma) instead of Twitter.\n\n" \
"Aware of privacy concerns, this bot will not store your location data." \
"*Be safe and cautious when sharing your real time location on the web.* \n\n" \
"Start using this bot by sharing your location using Telegram context menu to it."
await update.message.reply_text(hello, parse_mode=ParseMode.MARKDOWN)
await update.message.reply_text(PROMPT_CHOOSE_ACTION, reply_markup=MAIN_MENU)
return WAIT_LOCATION
async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text(PROMPT_HELP)
async def cancel_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
await update.message.reply_text(text=PROMPT_CANCELED, reply_markup=MAIN_MENU)
return ConversationHandler.END
|