Skip to content

Enforce users joining channels & passing custom parameters to callbacks #2380

Answered by LordST95
LordST95 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to @Bibo-Joshi, I could write answers as follow ...

1- for the last question, we could wrap our handlerFunction with functools as bellow:

from functools import partial

def start(update, context, foo=None):
    print("foo: ", foo)

start_handler = CommandHandler('start', partial(start,foo='sina'))
dispatcher.add_handler(start_handler)

2- for checking the subscription of users and write code for doing entrance stuff, we could write typeHandler. plz keep in mind that in this approach the group related to typeHandler should be lower than otherHandlers, because it should run before others ;)

def checkSubscription(update, context):
    #  check subscription with get_chat_member() or ad…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by LordST95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2379 on February 10, 2021 12:30.