WidgetQuery

class aiogram.types.widget_query.WidgetQuery(*, id: str, from_user: User, chat_instance: str, type: WidgetQueryTypeData | WidgetQueryTypeSignData | WidgetQueryTypeSentTransaction, data: str, chat: Chat | None = None, message_id: int | None = None, inline_message_id: str | None = None, chat_type: str | None = None, widget_id: str | None = None, **extra_data: Any)[source]

This object represents an incoming query from a widget in a message sent by the bot or via the bot. Use aiogram.methods.answer_widget_query.AnswerWidgetQuery to answer the query. Each user can send at most 5 queries per 5 seconds to the bot from all its widgets.

Source: https://core.telegram.org/bots/api#widgetquery

id: str

Unique identifier for this query

from_user: User

Sender

chat_instance: str

Global identifier, uniquely corresponding to the chat to which the message with the widget was sent

type: WidgetQueryTypeUnion

Type of the query

data: str

Data of the query, 1-64 bytes

chat: Chat | None

Optional. Chat with the message containing the widget; omitted if the widget is in an inline message

message_id: int | None

Optional. Identifier of the message containing the widget; omitted if the widget is in an inline message

inline_message_id: str | None

Optional. Identifier of the inline message containing the widget

chat_type: str | None

Optional. For widgets in inline messages, type of the chat to which the message was sent. Can be either ‘sender’ for a private chat with the inline query sender, ‘private’, ‘group’, ‘supergroup’, or ‘channel’

widget_id: str | None

Optional. Unique identifier of the shared widget, which sent the query; omitted if the widget isn’t shared

answer(data: str | None = None, **kwargs: Any) → AnswerWidgetQuery[source]

Shortcut for method aiogram.methods.answer_widget_query.AnswerWidgetQuery will automatically fill method attributes:

  • widget_query_id

Use this method to send an answer to a query from a widget. The query must be answered within 15 seconds. The answer is received only by the widget that sent the query and doesn’t change data of the widget; use aiogram.methods.edit_message_widget_data.EditMessageWidgetData or aiogram.methods.edit_shared_widget_data.EditSharedWidgetData to change it. On success, True is returned.

Source: https://core.telegram.org/bots/api#answerwidgetquery

Parameters:

data – Data to be returned to the widget, 0-1024 bytes

Returns:

instance of method aiogram.methods.answer_widget_query.AnswerWidgetQuery