Saravanan666/pypi-org huggingface dataset:
Package: aiogram-i18n
aiogram_i18nInstallation:pip install aiogram_i18nTo use FluentCompileCore:pip install fluent_compilerTo use FluentRuntimeCore:pip install fluent.runtimeimportasynciofromcontextlibimportsuppressfromloggingimportbasicConfig,INFOfromtypingimportAnyfromaiogramimportRouter,Dispatcher,F,Botfromaiogram.enumsimportParseModefromaiogram.filtersimportCommandStartfromaiogram.typesimportMessagefromaiogram_i18nimportI18nContext,LazyProxy,I18nMiddlewarefromaiogram_i18n.cores.fluent_runtime_coreimportFluentRuntimeCorefromaiogram_i18n.typesimport(ReplyKeyboardMarkup,KeyboardButton# you should import mutable objects from here if you want to use LazyProxy in them)router=Router(name=__name__)rkb=ReplyKeyboardMarkup(keyboard=[[KeyboardButton(text=LazyProxy("help"))]# or L.help()],resize_keyboard=True)@router.message(CommandStart())asyncdefcmd_start(message:Message,i18n:I18nContext)->Any:name=message.from_user.mention_html()returnmessage.reply(text=i18n.get("hello",user=name),# or i18n.hello(user=name)reply_markup=rkb)@router.message(F.text==LazyProxy("help"))asyncdefcmd_help(message:Message)->Any:returnmessage.reply(text="-- "+message.text+" --")asyncdefmain()->None:basicConfig(level=INFO)bot=Bot("42:ABC",parse_mode=ParseMode.HTML)i18n_middleware=I18nMiddleware(core=FluentRuntimeCore(path="locales/{locale}/LC_MESSAGES"))dp=Dispatcher()dp.include_router(router)i18n_middleware.setup(dispatcher=dp)awaitdp.start_polling(bot)if__name__=="__main__":withsuppress(KeyboardInterrupt):asyncio.run(main())
Package: aiogram-logging
aiogram-loggerSimplifies sending logs from your bots to DB.Quick start with InfluxDB + GrafanaInstall package from pippip install aiogram_loggingPrepare InlfuxDB and Grafana with thisrepo.Import and create instancesfromaiogram_loggingimportLogger,InfluxSendersender=InfluxSender(host='localhost',db='db-name',username='db-user',password='db-password')logger=Logger(sender)Create StatMiddleware to logging every incoming messageclassStatMiddleware(BaseMiddleware):def__init__(self):super(StatMiddleware,self).__init__()asyncdefon_process_message(self,message:types.Message,data:dict):awaitlogger.write_logs(self._manager.bot.id,message,parse_text=True)dp.middleware.setup(StatMiddleware())Create dashboard by yourself or import fromgrafana-dashboard.jsonYeah, you can connect several bots for one InfluxDBTODO:Explain how to manage logs from several bots in GrafanaParse more different data
Package: aiogram-media-group
aiogram-media-groupaiogram handler for media groups (also known as albums)Supported driversIn-memoryRedis(aiogram 2.x only)Mongo DB(aiogram 2.x only)Installpipinstallaiogram-media-group# orpoetryaddaiogram-media-groupUsageMinimal usage example:fromaiogram_media_groupimportmedia_group_handler@dp.message_handler(MediaGroupFilter(is_media_group=True),content_types=ContentType.PHOTO)@media_group_handlerasyncdefalbum_handler(messages:List[types.Message]):formessageinmessages:print(message)Checkoutexamplesfor complete usage examples
Package: aiogram-oop-framework
aiogram_oop_frameworkAn extender for aiogram to make it more OOPdocs:https://aiogram-oop-framework.readthedocs.io/en/latestLive Templatesfor PyCharmYou can find live templates in "misc/idea/live templates"To just install them all import all.zip through File | Manage IDE Settings | ImportTo install some of them you should follow these instructions:copy the content of file with template which you want to addgo to File | Settings | Editor | Live Templatesadd Template Group with any name you want (not required)add Live Template to the group you created (or Python group)Paste content to the created Live TemplateClick edit variablesEdit variables as showed below:NameExpressionDefault valueSkip if definedCLASS_NAMEcapitalize(fileNameWithoutExtension())as you wish
Package: aiogram-pagination
aiogram-paginationThis module will help you create layered callback menus.
The module is based on the concept that each callback has all the preceding callbacks in it.INSTALLATIONpip install aiogram-paginationQUICK STARTTo create callbacks you need to use the callback factory from
the aiogram-pagination modulefromaiogram_pagination.utils.callback_stack_factoryimportCallbackStackFactorycb=CallbackStackFactory('foo','bar')You can use both the simple version of the callback stack
and the version with abbreviated callbacks.Simple version:fromaiogram_pagination.callback_stackimportSimpleCallbackStackcallback_stack=SimpleCallbackStack(callback_data={'foo':0,'bar':1,'previous':''},callback_factory=cb)callback_stack.next(callback_data={'foo':6,'bar':6},callback_factory=cb)callback_stack.previous()Version with abbreviation:fromaiogram_pagination.callback_stackimportAbbreviatedCallbackStackcallback_stack=AbbreviatedCallbackStack(callback_data={'foo':0,'bar':1,'previous':''},callback_factory=cb)callback_stack.next(callback_data={'foo':6,'bar':6},callback_factory=cb)callback_stack.previous(default='some:callback')CONFIGURATIONFor configuration, you can use any configuration file placed
in the root directory of the project or in the data folder.The module uses configs under the "callback stack" key.
the default is config.json in the data folder of the aiogram-pagination module.Example:{"callback_stack":{"storage":"redis","cache_time_limit":3600,"max_pagination_depth":false,"redis_db":1}}
Package: aiogram-prometheus
aiogram Prometheus ExporterModule for exporting monitoring values for PrometheusInstallationpip install aiogram-prometheusQuick startimportasyncioimportloggingfromaiogramimportBot,Dispatcherfromaiogram.fsm.storage.memoryimportMemoryStoragefromaiogram.typesimportMessagefromdecoupleimportconfigfromaiogram_prometheusimport(DispatcherAiogramCollector,PrometheusMetricMessageMiddleware,PrometheusMetricStorageMixin,PrometheusPrometheusMetricRequestMiddleware,PushGatewayClient,StorageAiogramCollector,)logging.basicConfig(level='DEBUG')logger=logging.getLogger(__name__)bot=Bot('TOKEN')# Metric requests# which are made by the target botbot.session.middleware(PrometheusPrometheusMetricRequestMiddleware())# Metric storage# Change "MemoryStorage" to your storageclass_Storage(PrometheusMetricStorageMixin,MemoryStorage):passstorage_collector=StorageAiogramCollector()storage=_Storage(storage_collector)dp=Dispatcher(storage=storage)# Metric message# which are processed by the dispatcherdp.message.middleware(PrometheusMetricMessageMiddleware())# Metric base infoDispatcherAiogramCollector(dp)@dp.startup()asyncdefon_startup(bot:Bot):# Make connect to your `PUSHGATEWAY` server# For More: https://prometheus.io/docs/practices/pushing/client=PushGatewayClient('http://localhost:9091/','job-name')client.schedule_push()@dp.message()asyncdefhandle(message:Message)->None:awaitmessage.reply('Ok')asyncio.run(dp.start_polling(bot))ContributeIssue Tracker:https://gitlab.com/rocshers/python/aiogram-prometheus/-/issuesSource Code:https://gitlab.com/rocshers/python/aiogram-prometheusBefore adding changes:makeinstall-devAfter changes:makeformattest
Package: aiogram-sqlite-storage
A FSM Storage for aiogram 3.0+It's a very simple FSM Storage for the aiogram 3.0+. It uses local SQLite database for storing states and data. It's possible to chose method of serializing data in the database. A 'pickle' or a 'json' are available. A 'pickle' is used as default.Installation:pipinstallaiogram-sqlite-storageUsage:fromaiogramimportDispatcher# Import SQLStorage classfromaiogram_sqlite_storage.sqlitestoreimportSQLStorage# Initialise a storage# Path to a database is optional. 'fsm_starage.db' will be created for default.# 'serializing_method' is optional. 'pickle' is a default value. Also a 'json' is possible.my_storage=SQLStorage('my_db_path.db',serializing_method='pickle')# Initialize dispetcher with the storagedp=Dispatcher(storage=my_storage)# Use your FSM states and data as usual
Package: aiogram-tests
Aiogram Testsaiogram_testsis a testing library for bots written onaiogram📚 Simple examplesSimple handler testSimple bot:fromaiogramimportBot,Dispatcher,typesfromaiogram.fsm.contextimportFSMContext# Please, keep your bot tokens on environments, this code only examplebot=Bot('123456789:AABBCCDDEEFFaabbccddeeff-1234567890')dp=Dispatcher()@dp.message()asyncdefecho(message:types.Message,state:FSMContext)->None:awaitmessage.answer(message.text)if__name__=='__main__':dp.run_polling(bot)Test cases:importpytestfrombotimportechofromaiogram_testsimportMockedBotfromaiogram_tests.handlerimportMessageHandlerfromaiogram_tests.types.datasetimportMESSAGE@pytest.mark.asyncioasyncdeftest_echo():request=MockedBot(MessageHandler(echo))calls=awaitrequest.query(message=MESSAGE.as_object(text="Hello, Bot!"))answer_message=calls.send_messsage.fetchone()assertanswer_message.text=="Hello, Bot!"▶️Moreexamples
Package: aiogram-timepicker
Time Selection tool for Aiogram Telegram BotsDescriptionA simple inline time selection tool foraiogramtelegram bots written in Python.
Demo:@aiogram_timepicker_bot.Offers 9 types of panel time picker:Panel Pickers (aiogram_timepicker.panelandaiogram_timepicker.panel.single):Full Time Picker - user can select a time with hours, minutes and seconds.Minute & Second Picker - user can select a time with minutes and seconds.Single Hour Picker - user can select a hour.Single Minute Picker - user can select a minute.Single Second Picker - user can select a second.Carousel Pickers (aiogram_timepicker.carousel):Full Time Picker - user can select a time with hours, minutes and seconds with carousel.Clock Pickers (aiogram_timepicker.clock):c24 - user can select a hour between 0 and 24.c24_ts3 - user can select a minute/second between 0 and 57 with 3 timestamp.c60_ts5 - user can select a minute/second between 0 and 55 with 5 timestamp.UsageInstall package with pippip install aiogram_timepickerA full working example on how to use aiogram-timepicker is provided inbot_example.py.
You create a timepicker panel and add it to a message with areply_markupparameter, and then you can process it in acallbackqueyhandlermethod using theprocess_selectionmethod.DemoCode example isexamples/simple_aiogram_2.12_bot.pyand demo use@aiogram_timepicker_bot.LicenceRead more about licencehere.
Package: aiogram-tonconnect
📦 aiogram TON Connect UIAiogram TON Connect UIis a middleware library that streamlines the integration
ofTON Connecttechnology into Telegram bots based
onaiogram. It offers a pre-built user interface and orchestrates the interaction flow
for connecting wallets and initiating transactions. The library takes care of all user interactions with TON Connect
within the bot, encompassing the presentation of QR codes, texts, and keyboards, along with the handling of timeouts and
user cancellations.Check out thedocumentation.Bot example@aiogramTONConnectBot.Installationpip install aiogram-tonconnectFeaturesReady-to-Use User InterfaceMiddleware FunctionalityInterface CustomizationMultilingual SupportQR Code GenerationScreenshotsAcknowledgmentsThis project utilizes the following dependencies to enhance its functionality:aiogram:An asynchronous framework for building Telegram bots.pytonconnect:Python SDK for TON Connect 2.0.pytoniq-core:TON Blockchain primitives.qrcode-fastapi:Generate QR codes with optional image inclusion,
supports base64-encoded.and more...We extend our gratitude to the maintainers and contributors of these libraries for their valuable contributions to the
open-source community.ContributionWe welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or
submit a pull request.DonationsTON-EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNessUSDT(TRC-20) -TJjADKFT2i7jqNJAxkgeRm5o9uarcoLUeRLicenseThis repository is distributed under
theMIT License. Feel free to use, modify, and
distribute the code in accordance with the terms of the license.
Package: aiogram-translation
Aiogram Translation Plugin 🌐About 📘The Aiogram Translation Plugin is a convenient and powerful tool for integrating multilingual support into Aiogram-based Telegram bots. It enables seamless translation and language handling, making your bot accessible to a wider, global audience.Installation 📥python-mpipinstall-Uaiogram-translationUsage 🛠️To use the Aiogram Translation Plugin in your bot, import the necessary classes fromaiogram_translation. Set up your languages, default language, and register the translator with your dispatcher. Here's a basic example:main.pyfromaiogramimportDispatcher,Bot,Ffromaiogram.typesimportMessage,InlineKeyboardMarkup,InlineKeyboardButton,CallbackQueryfromaiogram_translationimportTranslatorfromtranslationsimport*fromosimportgetenvbot=Bot(getenv("TELEGRAM_TOKEN"))dispatcher=Dispatcher()translator=Translator()translator.include([English(),Russian(),Ukrainian()])translator.set_default('ru')translator.register(dispatcher)@dispatcher.message()asyncdefon_message(message:Message,language:BaseTranslation):kb=InlineKeyboardMarkup(resize_keyboard=True,inline_keyboard=[[InlineKeyboardButton(text=language.start_button,callback_data="hoooray")]])awaitmessage.reply(language.start_message,reply_markup=kb)@dispatcher.callback_query(F.data=="hoooray")asyncdefon_hooray(query:CallbackQuery,language:BaseTranslation):awaitquery.answer(language.start_button_alert,show_alert=True)dispatcher.run_polling(bot)translations.pyfromaiogram_translation.modelsimportBaseTranslationBuilderclassBaseTranslation(BaseTranslationBuilder):start_message:strstart_button:strstart_button_alert:strlink_lang_message:strclassEnglish(BaseTranslation):key="en"name="English"start_message="👋 Hi, I'm bot!"start_button="❤️ Click me!"start_button_alert="🎉 Hooray!"classRussian(BaseTranslation):key="ru"name="Русский (Russian)"start_message="👋 Привет, я бот"start_button="❤️ Нажми на меня"start_button_alert="🎉 Ура!"classUkrainian(BaseTranslation):key="uk"name="Український (Ukrainian)"start_message="👋 Привіт, я бот"start_button="❤️ Натисни на мене"start_button_alert="🎉 Ура!"Troubleshooting 🚨If you encounter issues or have queries, feel free to check ourIssues sectionon GitHub.Contribution 🤝Contributions are welcome. Please fork the repository, make your changes, and submit a pull request.License 📜This project is licensed under the MIT License - see theLICENSEfile for details.
Package: aiogram-unittest
aiogram_unittestaiogram_unittestis a testing library for bots written onaiogram📚 Simple examplesSimple handler testSimple bot:fromaiogramimportBot,Dispatcher,types,executor# Please, keep your bot tokens on environments, this code only examplebot=Bot('123456789:AABBCCDDEEFFaabbccddeeff-1234567890')dp=Dispatcher(bot)@dp.message_handler()asyncdefecho(message:types.Message):awaitmessage.answer(message.text)if__name__=='__main__':executor.start_polling(dp)Test cases:importunittestfrombotimportechofromaiogram_unittestimportRequesterfromaiogram_unittest.handlerimportMessageHandlerfromaiogram_unittest.types.datasetimportMESSAGEclassTestBot(unittest.IsolatedAsyncioTestCase):asyncdeftest_echo(self):request=Requester(request_handler=MessageHandler(echo))calls=awaitrequest.query(message=MESSAGE.as_object(text="Hello, Bot!"))answer_message=calls.send_messsage.fetchone()self.assertEqual(answer_message.text,'Hello, Bot!')▶️Moreexamples
Package: aiogram-uptodate
Aiogram UptodateThis project, a fork ofnoXplode/aiogram_calendar, introduces an intuitive and user-friendly calendar and timesheet for Telegram bots using theaiogramframework in Python.What's Inside?Dual Calendar Modes:Choose between comprehensive navigation or dialog-based selection.Hide Unnecessary Dates:Effortlessly conceal dates that are not requiredDate Range Limitation:Restrict date selection within a specific range.TimeSheet Dialog: Allows users to select a time slot after picking a date for easy scheduling.Highlight Today's Date:Easily identify the current date.Localisation Support:Customize the language or inherit from the user's locale settings.Compatibility:Aiogram 3:Fully supported from version 0.2 (for Aiogram 2 use version 0.1.1)Installationpipinstallaiogram_uptodate
Package: aiogram-ydb-storage
aiogram YDB Storageaiogram_ydb_storageis a storage implementation foraiogram FSMthat utilizes Yandex Database (YDB) as the storage backend. This allows you to persist state data for state machines used in your Telegram bots.InstallationYou can installaiogram_ydb_storagevia pip:pipinstallaiogram_ydb_storageUsageTo useaiogram_ydb_storage, you need to first set up your YDB database and obtain necessary credentials. Then, you can use it in conjunction withaiogramas follows:importasynciofromaiogramimportBot,Dispatcher,typesfromaiogram.filtersimportCommandStartfromaiogram.typesimportMessagefromaiogram.fsm.contextimportFSMContextfromaiogram.fsm.stateimportStatesGroup,Stateimportydbfromaiogram_ydb_storageimportYDBStorage# Configure YDB driverdriver_config=ydb.DriverConfig("grpcs://...",# YDB endpoint"...",# Database namecredentials=ydb.credentials_from_env_variables(),# Use YDB credentials from environment)# Initialize YDBStoragemy_storage=YDBStorage(driver_config=driver_config)# Initialize aiogram Bot and Dispatcherdp=Dispatcher(storage=my_storage)bot=Bot("token")# Define your statesclassMyStates(StatesGroup):test1=State()test2=State()# Handlers@dp.message(CommandStart())asyncdefcommand_start_handler(message:Message,state:FSMContext)->None:awaitstate.set_state(MyStates.test1)awaitmessage.answer("Set state test1")@dp.message(MyStates.test1)asyncdefhandler(message:types.Message,state:FSMContext)->None:awaitmessage.answer("state test1. Set state test2")awaitstate.set_state(MyStates.test2)@dp.message()asyncdefecho_handler(message:types.Message,state:FSMContext)->None:awaitmessage.answer("not state test1. Set state test1")awaitstate.set_state(MyStates.test1)# Main functionasyncdefmain()->None:awaitdp.start_polling(bot)# Run the main functionif__name__=="__main__":asyncio.run(main())ContributingContributions are welcome! Please feel free to submit issues or pull requests.LicenseThis project is licensed under the MIT License - see theLICENSEfile for details.
Package: aiograph
aiograph- asynchronous Python Telegra.ph API wrapper.AnnotationsThe Telegraph class (aiograph.Telegraph) encapsulates all API calls in a single class.
It provides functions such as create_page, get_views and other’s methods described atTelegra.ph/apipageAll data types  stored In the packageaiograph.types.All methods are named following thePEP-8instructions
for examplecreate_accountforcreateAccountmethod and etc.
All API methods are awaitable and can be called only inside Event-loop.Also if you want to upload the file to Telegra.ph service useuploadmethod
from the instance of Telegraph class.By the end of all actions you will need to close HTTP connections by calling theclose()method (is awaitable).InstallationUsing PIP$pipinstall-UaiographFrom sources$gitclonehttps://github.com/aiogram/aiograph.git$cdaiograph$pythonsetup.pyinstallUsage examplesBasicsimportasynciofromaiographimportTelegraphloop=asyncio.get_event_loop()telegraph=Telegraph()asyncdefmain():awaittelegraph.create_account('aiograph-demo')page=awaittelegraph.create_page('Demo','<p><strong>Hello, world!</strong></p>')print('Created page:',page.url)if__name__=='__main__':try:loop.run_until_complete(main())except(KeyboardInterrupt,SystemExit):passfinally:loop.run_until_complete(telegraph.close())# Close the aiohttp.ClientSessionLinksNews:@aiogram_liveCommunity:@aiogramRussian community:@aiogram_ruPip:aiographSource:Github repoIssues/Bug tracker:Github issues tracker
Package: aiographfix
aiographfix- asynchronous Python Telegra.ph API wrapper, that fix aiographAnnotationsThe Telegraph class (aiographfix.Telegraph) encapsulates all API calls in a single class.
It provides functions such as create_page, get_views and other’s methods described atTelegra.ph/apipageAll data types  stored In the packageaiographfix.types.All methods are named following thePEP-8instructions
for examplecreate_accountforcreateAccountmethod and etc.
All API methods are awaitable and can be called only inside Event-loop.Also if you want to upload the file to Telegra.ph service useuploadmethod
from the instance of Telegraph class.By the end of all actions you will need to close HTTP connections by calling theclose()method (is awaitable).InstallationUsing PIP$pipinstall-UaiographfixFrom sources$gitclonehttps://github.com/Yyonging/aiograph.git$cdaiograph$pythonsetup.pyinstallUsage examplesimportasynciofromaiographfiximportTelegraphloop=asyncio.get_event_loop()telegraph=Telegraph()asyncdefmain():awaittelegraph.create_account('aiograph-demo')page=awaittelegraph.create_page('Demo','<p><strong>Hello, world!</strong></p>')print('Created page:',page.url)if__name__=='__main__':try:loop.run_until_complete(main())except(KeyboardInterrupt,SystemExit):passfinally:loop.run_until_complete(telegraph.close())# Close the aiohttp.ClientSessionLinksNews:@aiogram_liveCommunity:@aiogramRussian community:@aiogram_ruPip:aiographfixSource:Github repoIssues/Bug tracker:Github issues tracker
Package: aiographfixed
aiographfix- asynchronous Python Telegra.ph API wrapper, that fix aiographAnnotationsThe Telegraph class (aiographfixed.Telegraph) encapsulates all API calls in a single class.
It provides functions such as create_page, get_views and other’s methods described atTelegra.ph/apipageAll data types  stored In the packageaiographfixed.types.All methods are named following thePEP-8instructions
for examplecreate_accountforcreateAccountmethod and etc.
All API methods are awaitable and can be called only inside Event-loop.Also if you want to upload the file to Telegra.ph service useuploadmethod
from the instance of Telegraph class.By the end of all actions you will need to close HTTP connections by calling theclose()method (is awaitable).InstallationUsing PIP$pipinstall-UaiographfixedFrom sources$gitclonehttps://github.com/Lunatik-cyber/aiographfixed.git$cdaiographfixed$pythonsetup.pyinstallUsage examplesimportasynciofromaiographfixedimportTelegraphloop=asyncio.get_event_loop()telegraph=Telegraph()asyncdefmain():awaittelegraph.create_account('aiograph-demo')page=awaittelegraph.create_page(title='Demo',content='<p><strong>Hello, world!</strong></p>',public=True)print('Created page:',page.url)if__name__=='__main__':try:loop.run_until_complete(main())except(KeyboardInterrupt,SystemExit):passfinally:loop.run_until_complete(telegraph.close())# Close the aiohttp.ClientSessionLinksNews:@aiogram_liveCommunity:@aiogramRussian community:@aiogram_ruPip:aiographfixSource:Github repoIssues/Bug tracker:Github issues tracker