AutoChatAction class

A transformer for Televerse that automatically sends chat actions based on the invoking method.

Suppose, if you're sending a message to the user with:

  ctx.reply("Hello World");

Wouldn't it be nice to have the "typing..." chat action automatically sent? This plugin does exactly that.

The AutoChatAction class implements the Transformer interface and is used to send chat actions such as typing, uploading photos, etc., based on the specified API method.

When a method is invoked, if it is in the list of allowed methods and not in the list of disallowed methods, a corresponding chat action is sent.

The class provides three properties:

  • allowedMethods: A list of API methods that are allowed to send chat actions.
  • disallowedMethods: A list of API methods that are not allowed to send chat actions.
  • interval: The duration between repeated chat action sends, if the process is not yet completed.

Constructors

AutoChatAction({List<APIMethod> allowedMethods = const [APIMethod.sendVideo, APIMethod.sendDocument, APIMethod.sendSticker, APIMethod.sendVoice, APIMethod.sendMessage, APIMethod.sendLocation, APIMethod.sendVideoNote, APIMethod.sendPhoto], List<APIMethod> disallowedMethods = const [], Duration interval = const Duration(seconds: 3)})
Class representing an instance of AutoChatAction.
const

Properties

allowedMethods List<APIMethod>
A list of API methods that are allowed to send chat actions.
final
disallowedMethods List<APIMethod>
A list of API methods that are not allowed to send chat actions.
final
hashCode int
The hash code for this object.
no setterinherited
interval Duration
The duration between repeated chat action sends.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
transform(APICaller call, APIMethod method, [Payload? payload]) Future<Map<String, dynamic>>
Transforms the payload before the API call.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited