withTyping<T> method
Shows typing indicator and executes a function.
This is useful for long operations to show the user that the bot is working.
Example:
await ctx.withTyping(() async {
// Some long operation
await Future.delayed(Duration(seconds: 2));
await ctx.reply('Done!');
});
Implementation
Future<T> withTyping<T>(Future<T> Function() operation) async {
await sendTyping();
return await operation();
}