mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
add type checking import
This commit is contained in:
@@ -23,4 +23,7 @@ logging.basicConfig(
|
|||||||
level=os.getenv("LOG_LEVEL", "WARNING"),
|
level=os.getenv("LOG_LEVEL", "WARNING"),
|
||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||||
)
|
)
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
def get_logger(name: str) -> logging.Logger:
|
||||||
|
return logging.getLogger(name)
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import html
|
import html
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from telegram import Chat, InlineKeyboardButton, InlineKeyboardMarkup, Message, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from telegram.constants import ChatAction, ChatType, ParseMode
|
from telegram.constants import ChatAction, ChatType, ParseMode
|
||||||
from telegram.ext import (Application, ApplicationBuilder, CallbackQueryHandler, CommandHandler, ContextTypes, Defaults,
|
from telegram.ext import (ApplicationBuilder, CallbackQueryHandler, CommandHandler, Defaults,
|
||||||
InlineQueryHandler, MessageHandler, PicklePersistence, filters)
|
InlineQueryHandler, MessageHandler, PicklePersistence, filters)
|
||||||
|
|
||||||
import common
|
import common
|
||||||
from common import logger
|
|
||||||
from tweet import TGTweet
|
from tweet import TGTweet
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from telegram import Chat, Message, Update
|
||||||
|
from telegram.ext import Application, ContextTypes
|
||||||
|
|
||||||
|
logger = common.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def send_action(action):
|
def send_action(action):
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import html
|
import html
|
||||||
from typing import Generator
|
from typing import Generator, TYPE_CHECKING
|
||||||
|
|
||||||
|
from telegram import (InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQueryResultVideo, InputMediaPhoto,
|
||||||
|
InputMediaVideo)
|
||||||
|
|
||||||
|
from common import get_logger, x_media_regex, x_tco_regex, x_url_regex
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from telegram import (
|
|
||||||
InlineQueryResultPhoto,
|
|
||||||
InlineQueryResultVideo,
|
|
||||||
InlineQueryResultMpeg4Gif,
|
|
||||||
InputMediaPhoto,
|
|
||||||
InputMediaVideo
|
|
||||||
)
|
|
||||||
|
|
||||||
from common import x_url_regex, x_media_regex, x_tco_regex, logger
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
twimg_url = 'https://pbs.twimg.com/'
|
twimg_url = 'https://pbs.twimg.com/'
|
||||||
vx_api_url = 'https://api.vxtwitter.com/{0}/status/{1}'
|
vx_api_url = 'https://api.vxtwitter.com/{0}/status/{1}'
|
||||||
|
|||||||
Reference in New Issue
Block a user