Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update examples for aiogram 3.7.0+ #40

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ from contextlib import suppress
from logging import basicConfig, INFO
from typing import Any

from aiogram import Router, Dispatcher, F, Bot
from aiogram import Router, Dispatcher, Bot
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.filters import CommandStart
from aiogram.types import Message
Expand Down Expand Up @@ -51,7 +52,7 @@ async def cmd_help(message: Message) -> Any:

async def main() -> None:
basicConfig(level=INFO)
bot = Bot("42:ABC", parse_mode=ParseMode.HTML)
bot = Bot("42:ABC", default=DefaultBotProperties(parse_mode=ParseMode.HTML))
i18n_middleware = I18nMiddleware(
core=FluentRuntimeCore(
path="locales/{locale}/LC_MESSAGES"
Expand Down
6 changes: 5 additions & 1 deletion examples/language_inline_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import environ

from aiogram import Router, Dispatcher, Bot, F
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.filters import Command, CommandStart
from aiogram.types import CallbackQuery, Message
Expand Down Expand Up @@ -50,7 +51,10 @@ async def cmd_lang(message: Message, i18n: I18nContext):
async def main():
logging.basicConfig(level=logging.INFO)
dp = Dispatcher()
bot = Bot(token=environ["BOT_TOKEN"], parse_mode=ParseMode.HTML)
bot = Bot(
token=environ["BOT_TOKEN"],
default=DefaultBotProperties(parse_mode=ParseMode.HTML),
)
mw = I18nMiddleware(
core=FluentRuntimeCore(
path="locales/{locale}/LC_MESSAGES",
Expand Down
3 changes: 2 additions & 1 deletion examples/mre.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any

from aiogram import Bot, Dispatcher, Router
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.filters import CommandStart
from aiogram.types import Message
Expand Down Expand Up @@ -37,7 +38,7 @@ async def cmd_help(message: Message) -> Any:

async def main() -> None:
basicConfig(level=INFO)
bot = Bot("42:ABC", parse_mode=ParseMode.HTML)
bot = Bot("42:ABC", default=DefaultBotProperties(parse_mode=ParseMode.HTML))
i18n_middleware = I18nMiddleware(core=FluentRuntimeCore(path="locales/{locale}/LC_MESSAGES"))

dp = Dispatcher()
Expand Down
6 changes: 5 additions & 1 deletion examples/sqlalchemy_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Callable, Dict, Any, Awaitable

from aiogram import BaseMiddleware, Dispatcher, Bot
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.types import TelegramObject, User
from sqlalchemy import BigInteger, String
Expand Down Expand Up @@ -104,7 +105,10 @@ async def __call__(
async def main():
logging.basicConfig(level=logging.INFO)
dp = Dispatcher()
bot = Bot(token=environ["BOT_TOKEN"], parse_mode=ParseMode.HTML)
bot = Bot(
token=environ["BOT_TOKEN"],
default=DefaultBotProperties(parse_mode=ParseMode.HTML),
)

mw = I18nMiddleware(
core=FluentRuntimeCore(
Expand Down
Loading