mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
Remove Version Check from Examples (#3846)
This commit is contained in:
parent
71eff4731c
commit
58a109aae6
23 changed files with 23 additions and 326 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""This example showcases how PTBs "arbitrary callback data" feature can be used.
|
"""This example showcases how PTBs "arbitrary callback data" feature can be used.
|
||||||
|
@ -14,19 +14,6 @@ To use arbitrary callback data, you must install PTB via
|
||||||
import logging
|
import logging
|
||||||
from typing import List, Tuple, cast
|
from typing import List, Tuple, cast
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -14,19 +14,6 @@ bot.
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import Chat, ChatMember, ChatMemberUpdated, Update
|
from telegram import Chat, ChatMember, ChatMemberUpdated, Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -14,19 +14,6 @@ import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import DefaultDict, Optional, Set
|
from typing import DefaultDict, Optional, Set
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -16,19 +16,6 @@ bot.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 5):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
|
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -17,19 +17,6 @@ bot.
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
|
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
# pylint: disable=import-error,wrong-import-position,unused-argument
|
# pylint: disable=import-error,unused-argument
|
||||||
"""
|
"""
|
||||||
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
||||||
For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please
|
For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please
|
||||||
|
@ -26,20 +26,6 @@ from django.core.asgi import get_asgi_application
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseBadRequest
|
from django.http import HttpRequest, HttpResponse, HttpResponseBadRequest
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
# pylint: disable=import-error,wrong-import-position,unused-argument
|
# pylint: disable=import-error,unused-argument
|
||||||
"""
|
"""
|
||||||
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
||||||
For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Please
|
For the custom webhook setup, the libraries `flask`, `asgiref` and `uvicorn` are used. Please
|
||||||
|
@ -23,20 +23,6 @@ import uvicorn
|
||||||
from asgiref.wsgi import WsgiToAsgi
|
from asgiref.wsgi import WsgiToAsgi
|
||||||
from flask import Flask, Response, abort, make_response, request
|
from flask import Flask, Response, abort, make_response, request
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
# pylint: disable=import-error,wrong-import-position,unused-argument
|
# pylint: disable=import-error,unused-argument
|
||||||
"""
|
"""
|
||||||
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
||||||
For the custom webhook setup, the libraries `quart` and `uvicorn` are used. Please
|
For the custom webhook setup, the libraries `quart` and `uvicorn` are used. Please
|
||||||
|
@ -22,20 +22,6 @@ from http import HTTPStatus
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from quart import Quart, Response, abort, make_response, request
|
from quart import Quart, Response, abort, make_response, request
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
# pylint: disable=import-error,wrong-import-position,unused-argument
|
# pylint: disable=import-error,unused-argument
|
||||||
"""
|
"""
|
||||||
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
Simple example of a bot that uses a custom webhook setup and handles custom updates.
|
||||||
For the custom webhook setup, the libraries `starlette` and `uvicorn` are used. Please install
|
For the custom webhook setup, the libraries `starlette` and `uvicorn` are used. Please install
|
||||||
|
@ -25,20 +25,6 @@ from starlette.requests import Request
|
||||||
from starlette.responses import PlainTextResponse, Response
|
from starlette.responses import PlainTextResponse, Response
|
||||||
from starlette.routing import Route
|
from starlette.routing import Route
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""Bot that explains Telegram's "Deep Linking Parameters" functionality.
|
"""Bot that explains Telegram's "Deep Linking Parameters" functionality.
|
||||||
|
@ -20,19 +20,6 @@ bot.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, helpers
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, helpers
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, filters
|
from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, filters
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -17,19 +17,6 @@ bot.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import ForceReply, Update
|
from telegram import ForceReply, Update
|
||||||
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
|
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""This is a very simple example on how one could implement a custom error handler."""
|
"""This is a very simple example on how one could implement a custom error handler."""
|
||||||
|
@ -8,19 +8,6 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import Application, CommandHandler, ContextTypes
|
from telegram.ext import Application, CommandHandler, ContextTypes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -18,19 +18,6 @@ import logging
|
||||||
from html import escape
|
from html import escape
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineQueryResultArticle, InputTextMessageContent, Update
|
from telegram import InlineQueryResultArticle, InputTextMessageContent, Update
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.ext import Application, CommandHandler, ContextTypes, InlineQueryHandler
|
from telegram.ext import Application, CommandHandler, ContextTypes, InlineQueryHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -8,19 +8,6 @@ Basic example for a bot that uses inline keyboards. For an in-depth explanation,
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes
|
from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""Simple inline keyboard bot with multiple CallbackQueryHandlers.
|
"""Simple inline keyboard bot with multiple CallbackQueryHandlers.
|
||||||
|
@ -16,19 +16,6 @@ Press Ctrl-C on the command line to stop the bot.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -17,19 +17,6 @@ bot.
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, Tuple
|
from typing import Any, Dict, Tuple
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -17,19 +17,6 @@ To use Telegram Passport, you must install PTB via
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 5):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.ext import Application, ContextTypes, MessageHandler, filters
|
from telegram.ext import Application, ContextTypes, MessageHandler, filters
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""Basic example for a bot that can receive payment from user."""
|
"""Basic example for a bot that can receive payment from user."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import LabeledPrice, ShippingOption, Update
|
from telegram import LabeledPrice, ShippingOption, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -17,19 +17,6 @@ bot.
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
|
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
|
||||||
from telegram.ext import (
|
from telegram.ext import (
|
||||||
Application,
|
Application,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -9,19 +9,6 @@ one the user sends the bot
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import (
|
from telegram import (
|
||||||
KeyboardButton,
|
KeyboardButton,
|
||||||
KeyboardButtonPollType,
|
KeyboardButtonPollType,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=wrong-import-position
|
# pylint: disable=import-error
|
||||||
"""Simple Bot to reply to Telegram messages.
|
"""Simple Bot to reply to Telegram messages.
|
||||||
|
|
||||||
This is built on the API wrapper, see echobot.py to see the same example built
|
This is built on the API wrapper, see echobot.py to see the same example built
|
||||||
|
@ -11,19 +11,6 @@ import contextlib
|
||||||
import logging
|
import logging
|
||||||
from typing import NoReturn
|
from typing import NoReturn
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment] # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import Bot, Update
|
from telegram import Bot, Update
|
||||||
from telegram.error import Forbidden, NetworkError
|
from telegram.error import Forbidden, NetworkError
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument, wrong-import-position
|
# pylint: disable=unused-argument, import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -24,19 +24,6 @@ To use the JobQueue, you must install PTB via
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.ext import Application, CommandHandler, ContextTypes
|
from telegram.ext import Application, CommandHandler, ContextTypes
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# pylint: disable=unused-argument,wrong-import-position
|
# pylint: disable=unused-argument,import-error
|
||||||
# This program is dedicated to the public domain under the CC0 license.
|
# This program is dedicated to the public domain under the CC0 license.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -11,19 +11,6 @@ require a bot token.
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telegram import __version__ as TG_VER
|
|
||||||
|
|
||||||
try:
|
|
||||||
from telegram import __version_info__
|
|
||||||
except ImportError:
|
|
||||||
__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
|
|
||||||
|
|
||||||
if __version_info__ < (20, 0, 0, "alpha", 1):
|
|
||||||
raise RuntimeError(
|
|
||||||
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
|
|
||||||
f"{TG_VER} version of this example, "
|
|
||||||
f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
|
|
||||||
)
|
|
||||||
from telegram import KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove, Update, WebAppInfo
|
from telegram import KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove, Update, WebAppInfo
|
||||||
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
|
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue