-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from ilya-nikolaev/develop
Added aiogram>=3.4.0 support to `AiogramSulgukMiddleware`
- Loading branch information
Showing
4 changed files
with
73 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import asyncio | ||
import os | ||
|
||
from aiogram import Bot | ||
from aiogram.client.default import DefaultBotProperties | ||
|
||
from sulguk import SULGUK_PARSE_MODE, AiogramSulgukMiddleware | ||
|
||
CHAT_ID = 1 | ||
|
||
|
||
async def main(): | ||
bot = Bot( | ||
token=os.getenv("BOT_TOKEN"), | ||
default=DefaultBotProperties(parse_mode=SULGUK_PARSE_MODE), | ||
) | ||
bot.session.middleware(AiogramSulgukMiddleware()) | ||
|
||
await bot.send_poll( | ||
CHAT_ID, | ||
question="Do you like Python?", | ||
options=[ | ||
"Yes!", | ||
"No", | ||
"Probably...", | ||
], | ||
explanation="<b>You</b> <i>like it</i>.", | ||
correct_option_id=0, | ||
type="quiz", | ||
) | ||
|
||
await bot.session.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters