From 8ef8733a2be13a69e91d1bf205cc8306533d4e5c Mon Sep 17 00:00:00 2001 From: FlorianDahn Date: Mon, 5 Oct 2020 14:21:57 +0200 Subject: [PATCH] Update DeviceSession.cs - Adding the name parameter to SendPhoto methods - Adding caption parameter to SendVideo methods --- TelegramBotBase/Sessions/DeviceSession.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/TelegramBotBase/Sessions/DeviceSession.cs b/TelegramBotBase/Sessions/DeviceSession.cs index 1574de0..01e12a4 100644 --- a/TelegramBotBase/Sessions/DeviceSession.cs +++ b/TelegramBotBase/Sessions/DeviceSession.cs @@ -41,9 +41,9 @@ namespace TelegramBotBase.Sessions /// public String GetChatTitle() { - return LastMessage?.Chat.Title - ?? LastMessage?.Chat.Username - ?? LastMessage?.Chat.FirstName + return LastMessage?.Chat.Title + ?? LastMessage?.Chat.Username + ?? LastMessage?.Chat.FirstName ?? ChatTitle; } @@ -381,7 +381,7 @@ namespace TelegramBotBase.Sessions /// /// /// - public async Task SendPhoto(InputOnlineFile file, ButtonForm buttons = null, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default) + public async Task SendPhoto(InputOnlineFile file, String name = null, ButtonForm buttons = null, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default) { if (this.ActiveForm == null) return null; @@ -392,7 +392,7 @@ namespace TelegramBotBase.Sessions try { - m = await this.Client.TelegramClient.SendPhotoAsync(this.DeviceId, file, parseMode: parseMode, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification); + m = await this.Client.TelegramClient.SendPhotoAsync(this.DeviceId, file, caption: name, parseMode: parseMode, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification); OnMessageSent(new MessageSentEventArgs(m)); } @@ -423,7 +423,7 @@ namespace TelegramBotBase.Sessions { InputOnlineFile fts = new InputOnlineFile(fileStream, name); - return await SendPhoto(fts, buttons, replyTo, disableNotification); + return await SendPhoto(fts, name: name, buttons, replyTo, disableNotification); } } @@ -442,7 +442,7 @@ namespace TelegramBotBase.Sessions { InputOnlineFile fts = new InputOnlineFile(fileStream, name); - return await SendPhoto(fts, buttons, replyTo, disableNotification); + return await SendPhoto(fts, name: name, buttons, replyTo, disableNotification); } } @@ -454,7 +454,7 @@ namespace TelegramBotBase.Sessions /// /// /// - public async Task SendVideo(InputOnlineFile file, ButtonForm buttons = null, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default) + public async Task SendVideo(InputOnlineFile file, String caption = null, ButtonForm buttons = null, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default) { if (this.ActiveForm == null) return null; @@ -465,7 +465,7 @@ namespace TelegramBotBase.Sessions try { - m = await this.Client.TelegramClient.SendVideoAsync(this.DeviceId, file, parseMode: parseMode, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification); + m = await this.Client.TelegramClient.SendVideoAsync(this.DeviceId, file, caption: caption, parseMode: parseMode, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification); OnMessageSent(new MessageSentEventArgs(m)); }