Skip to content

Commit

Permalink
update examples for aiogram 3.7.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladyslav49 committed Nov 30, 2024
1 parent cd35798 commit da8e90e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
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

0 comments on commit da8e90e

Please sign in to comment.