Skip to content

Added parse_mode parameter in Updater and in Bot class #1226

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

Closed
wants to merge 1 commit into from
Closed

Added parse_mode parameter in Updater and in Bot class #1226

wants to merge 1 commit into from

Conversation

ak4zh
Copy link
Contributor

@ak4zh ak4zh commented Sep 27, 2018

Added parse_mode parameter in Updater and in Bot class to allow to set a default parse mode for your bot.

@Eldinnie
Copy link
Member

Eldinnie commented Oct 1, 2018

Hi @ak4zh

We discussed this feature several times in the developers chat. But never came to a good way to offer it.
The following are the requirements and thinkpoints we've come up with so far

  • If a default parse_mode is set and none is given. Add it.
  • If a default parse_mode is set and another parse_mode is given. Use the given one
  • If a default parse_mode is set and None is given. Use no parse_mode
  • Default parse_mode should be used for text messages and captions for every media type
  • Default parse_mode should be used for answers to an inline_query <- This is the very tricky one.
  • Tests for all the above.

Right now your PR is not up to these requests. Are you willing to put in some work to try a solution as I just described?

Copy link
Member

@Eldinnie Eldinnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

@ak4zh
Copy link
Contributor Author

ak4zh commented Oct 1, 2018

Regarding:

If a default parse_mode is set and None is given. Use no parse_mode

What seems a better approach.

-> Default parse mode is set, so it always uses the default one and use other parse_mode if something is passed specifically.

To use no parse_mode you can pass parse_mode=False and no parse mode will be used.

Will look something like:

if parse_mode:
    data[‘parse_mode’] = parse_mode
elif parse_mode is False:
    data[‘parse_mode’] = None
elif self.parse_mode:
    data[‘parse_mode’] = self.parse_mode

Or another approach can be, adding another parameter

use_default_parse_mode=True

So whenever you pass nothing in parse_mode it’s None and will use default parse mode (if anything is set)

If you want to use no parse mode, just pass

use_default_parse_mode=False

@Poolitzer
Copy link
Member

will be implemented with #1490, closing

@Poolitzer Poolitzer closed this Jan 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants