diff options
-rw-r--r-- | bot.py | 8 | ||||
-rw-r--r-- | callback.py | 7 | ||||
-rw-r--r-- | command.py | 13 | ||||
-rw-r--r-- | config.py | 14 |
4 files changed, 12 insertions, 30 deletions
@@ -1,8 +1,12 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | 2 | ||
3 | import logging | ||
4 | from callback import * | ||
5 | from telegram.ext import Application, CallbackQueryHandler, CommandHandler, MessageHandler, filters, ConversationHandler | 3 | from telegram.ext import Application, CallbackQueryHandler, CommandHandler, MessageHandler, filters, ConversationHandler |
4 | import logging | ||
5 | from callback import callback_skip_media, callback_location_sharing, callback_manual_location, \ | ||
6 | callback_location_confirmation, callback_location_keyword_search, callback_skip_location_keyword, \ | ||
7 | callback_add_comment, callback_skip_comment, callback_add_media | ||
8 | from config import WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, ADD_MEDIA, ADD_COMMENT, BOT_TOKEN | ||
9 | from command import start_command, cancel_command, help_command | ||
6 | 10 | ||
7 | logging.basicConfig( | 11 | logging.basicConfig( |
8 | format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO | 12 | format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO |
diff --git a/callback.py b/callback.py index 8c80028..687508a 100644 --- a/callback.py +++ b/callback.py | |||
@@ -4,14 +4,11 @@ from foursquare.poi import query_poi | |||
4 | from dbstore.dbm_store import get_loc | 4 | from dbstore.dbm_store import get_loc |
5 | from toot import mastodon_client | 5 | from toot import mastodon_client |
6 | from command import * | 6 | from command import * |
7 | from telegram import __version__ as TG_VER | ||
8 | from typing import cast, List | 7 | from typing import cast, List |
9 | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, ReplyKeyboardMarkup, KeyboardButton | 8 | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove |
10 | from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, MessageHandler, filters, \ | 9 | from telegram.ext import ContextTypes, ConversationHandler, CallbackContext |
11 | ConversationHandler, CallbackContext | ||
12 | from telegram.constants import ParseMode, ChatAction | 10 | from telegram.constants import ParseMode, ChatAction |
13 | from telegram.error import BadRequest | 11 | from telegram.error import BadRequest |
14 | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove | ||
15 | 12 | ||
16 | 13 | ||
17 | async def callback_skip_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | 14 | async def callback_skip_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: |
@@ -1,13 +1,8 @@ | |||
1 | from config import * | 1 | from telegram import Update |
2 | from telegram.constants import ParseMode | ||
3 | from telegram.ext import ContextTypes, ConversationHandler | ||
2 | 4 | ||
3 | from telegram import __version__ as TG_VER | 5 | from config import * |
4 | from typing import cast, List | ||
5 | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, ReplyKeyboardMarkup, KeyboardButton | ||
6 | from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, MessageHandler, filters, \ | ||
7 | ConversationHandler, CallbackContext | ||
8 | from telegram.constants import ParseMode, ChatAction | ||
9 | from telegram.error import BadRequest | ||
10 | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove | ||
11 | 6 | ||
12 | 7 | ||
13 | async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: | 8 | async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: |
@@ -1,19 +1,5 @@ | |||
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 | 3 | from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, KeyboardButton |
18 | from prompt.string import * | 4 | from prompt.string import * |
19 | from typing import TypedDict | 5 | from typing import TypedDict |