Skip to content

Cannot pass arbitrary kwargs to Dispatcher constructor #982

Closed
@MasterGroosha

Description

@MasterGroosha

Checklist

  • I am sure the error is coming from aiogram code
  • I have searched in the issue tracker for similar bug reports, including closed ones

Operating system

Manjaro

Python version

3.10.x

aiogram version

3.0b4

Expected behavior

According to the documentation, you can pass arbitrary kwargs to Dispatcher's constructor.

Current behavior

Apparently, that's not possible. The code below results in the following error:

Traceback (most recent call last):
  File "/home/groosha/PycharmProjects/aiogram-3.x-playground/bot.py", line 6, in <module>
    dp = Dispatcher(another="hello")
  File "/home/groosha/PycharmProjects/aiogram-3.x-playground/venv/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 52, in __init__
    super(Dispatcher, self).__init__(**kwargs)
TypeError: Router.__init__() got an unexpected keyword argument 'another'

Steps to reproduce

  1. Run the code below

Code example

import asyncio
from aiogram import Bot, Dispatcher

bot = Bot(token="TOKEN")
dp = Dispatcher(another="hello")

async def main():
    await dp.start_polling(bot)

if __name__ == "__main__":
    asyncio.run(main())

Logs

No response

Additional information

This bug was also reported at https://t.me/aiogram_ru/1170161

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xIssue or PR for stable 3.x versionbugSomething is wrong with the frameworkdocsSomething is missing in docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions