replyWithPhoto method
Future<Message>
replyWithPhoto(
- InputFile photo, {
- int? messageThreadId,
- String? caption,
- ParseMode? parseMode,
- List<
MessageEntity> ? captionEntities, - bool? disableNotification,
- bool? protectContent,
- ReplyMarkup? replyMarkup,
- bool? hasSpoiler,
- ReplyParameters? replyParameters,
- String? businessConnectionId,
- String? messageEffectId,
- bool? showCaptionAboveMedia,
- bool? allowPaidBroadcast,
- int? directMessagesTopicId,
- SuggestedPostParameters? suggestedPostParameters,
Replies to the current message with a photo.
This is a convenience method that sends a photo to the same chat where the current update originated from.
Parameters:
photo: Photo to send (InputFile)caption: Photo caption (0-1024 characters)parseMode: Mode for parsing entities in the photo captioncaptionEntities: List of special entities that appear in the captiondisableNotification: Sends the message silentlyprotectContent: Protects the contents from forwarding and savingreplyParameters: Description of the message to reply toreplyMarkup: Additional interface optionshasSpoiler: Pass True if the photo needs to be covered with a spoiler animation
Returns the sent Message.
Throws TeleverseException if there's no chat to reply to.
Example:
final photo = InputFile.fromFile(File('photo.jpg'));
await ctx.replyWithPhoto(photo, caption: 'Beautiful sunset! 🌅');
Implementation
Future<Message> replyWithPhoto(
InputFile photo, {
int? messageThreadId,
String? caption,
ParseMode? parseMode,
List<MessageEntity>? captionEntities,
bool? disableNotification,
bool? protectContent,
ReplyMarkup? replyMarkup,
bool? hasSpoiler,
ReplyParameters? replyParameters,
String? businessConnectionId,
String? messageEffectId,
bool? showCaptionAboveMedia,
bool? allowPaidBroadcast,
int? directMessagesTopicId,
SuggestedPostParameters? suggestedPostParameters,
}) async {
final chatId = _getChatId();
_verifyInfo([chatId], APIMethod.sendPhoto);
return api.sendPhoto(
chatId!,
photo,
messageThreadId: _threadId(messageThreadId),
caption: caption,
parseMode: parseMode,
captionEntities: captionEntities,
disableNotification: disableNotification,
protectContent: protectContent,
replyMarkup: replyMarkup,
hasSpoiler: hasSpoiler,
replyParameters: replyParameters,
businessConnectionId: _businessConnectionId(businessConnectionId),
messageEffectId: messageEffectId,
showCaptionAboveMedia: showCaptionAboveMedia,
allowPaidBroadcast: allowPaidBroadcast,
directMessagesTopicId: directMessagesTopicId,
suggestedPostParameters: suggestedPostParameters,
);
}