tgram_dnd.actions.api package

Subpackages

Submodules

tgram_dnd.actions.api.raw module

class tgram_dnd.actions.api.raw.Raw(func_name: str, kwgs: dict = {}, middleware: Callable = None, fill_vars: bool = True)[source]

Bases: Action

Run a method from the Update

action = Raw(
    func_name='reply_text',
    kwgs={"text": "Wassup"},
)
await action(Message)
# Called Message.reply_text(text="Wassup")
Parameters:
  • func (Callable, optional) – the function that will be executed

  • kwgs (dict[str, Any], optional) – additonal arguments for func

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

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

tgram_dnd.actions.api.raw_call module

class tgram_dnd.actions.api.raw_call.RawCall(func_name: str, kwgs: dict = {}, middleware: Callable = None, fill_vars: bool = True)[source]

Bases: Action

Run a method from the TgBot instance

action = RawCall(
    func_name='get_me',
)
res = await action(AnyUpdate)

print(res)
# <class 'tgram.types.User'>
print("@" + res.username)
# @MyAwesomeBot
Parameters:
  • func (Callable, optional) – the function that will be executed

  • kwgs (dict[str, Any], optional) – additonal arguments for func

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

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

Module contents