Skip to content

Creating Plugins

Devesh Pal edited this page Jul 18, 2022 · 1 revision

Imports

You can import most of things that you may need while creating plugins from init file of the folder (either addons or plugins)

from . import *

Command Handler

ultroid_cmd is the decorator used for handling message update (that is commands or relevant). ultroid_cmd do most of the work like managing handlers for dual/bot/user mode or even manager.

Example

@ultroid_cmd(pattern="hello")
async def handler(event):
    await event.eor("Hello World!")

Inline Handler

  • in_pattern is the decorator used for Inline Assistant Updates.

Example

@in_pattern("hi")
async def inline(event):
    await event.answer(
       [
       await event.builder.article(title="Hello", text="Hello from Inline...")
       ]
     )

Callback Handler

  • @callback is used for Callback events.

Example

@callback("query")
async def _(ult):
    await ult.answer("How are you?")
Clone this wiki locally