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

Validate kwargs in Client.start #2170

Closed
wants to merge 1 commit into from

Conversation

@NCPlayz
Copy link
Contributor

commented May 19, 2019

Summary

This resolves #953, a feature request suggesting the validation of keyword arguments for Client.run (passed to Client.start). I am aware that a Pull Request for this was already given, but it was closed as the rewrite branch got deleted (#1896), as well as not being updated. Likewise, I take in mind what Danny has said.

I also thought that ConnectionState keyword arguments should be validated, in case a user error is made when instantiating Client. However, this seemed to have taken more time to start up the bot, hence why it is not included.

>>> bot.run(TOKEN, user=False, say_hello_on_boot=True)
Traceback (most recent call last):
  File "python\discord\client.py", line 556, in runner
    await self.start(*args, **kwargs)
  File "python\discord\client.py", line 517, in start
    raise TypeError("unexpected keyword argument(s) %s" % list(kwargs.keys()))
TypeError: unexpected keyword argument(s) ['user', 'say_hello_on_boot']

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Rapptz Rapptz added this to the v1.2 milestone May 19, 2019

@Rapptz Rapptz added the rebased label May 19, 2019

@Rapptz Rapptz closed this May 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.