tgram_dnd.actions.api.methods package

Submodules

tgram_dnd.actions.api.methods.check_subscription module

class tgram_dnd.actions.api.methods.check_subscription.Subscribed(kwgs: SubscribedKwargs, middleware=None, fill_vars=True, allow_restricted: bool = True, default_value: bool = False)[source]

Bases: Action

this Action is used to check wether a user is a member in the specified channel/chat

from tgram_dnd import ..., Subscribed, Reply, Condition

Condition(
    action=Subscribed({
        "chat_id": CHAT_ID,
        "user_id": "{{from.id}}"
    }),
    success=Reply("text", {"text": "You are Subscribed"}),
    fail=Reply("text", {"text": "You are NOT Subscribed please subscribe @YourChat"})
)
Parameters:
  • kwgs – (tgram_dnd.actions.api.methods.check_subscription.SubscribedKwargs): the check arguments

  • middleware (Callable, optional) – a function to be executed before the main function run

  • fill_vars (bool, True) – Wether to automatically render vars in kwgs or not, defaults to true

  • allow_resticted (bool, True) – wether to count RestrictedChatMember as an allowed condition or not

  • default_value (bool, False) – the default boolean value returned when an Exception occurs during the check process, defaults to False (Operation Failed)

class tgram_dnd.actions.api.methods.check_subscription.SubscribedKwargs[source]

Bases: TypedDict

chat_id: int | str
user_id: int | str

tgram_dnd.actions.api.methods.reply module

class tgram_dnd.actions.api.methods.reply.Reply(func_name: tgram_dnd.enums.reply_methods.REPLY_METHODS, kwgs: ReplyInput = {}, middleware: Callable = None, fill_vars: bool = True)[source]

Bases: Action

an abstract method to Reply to update

Parameters:

Module contents