- adding new SentData Event in FormBase for User uploads (for Photo, Audio, Video, Contact, Location, Document)

- adding RequestUserLocation and RequestUserContact to Device class
- Update to Device class
- updating examples
- adding example for data upload
- small documentary Updates (Readme.md)
This commit is contained in:
FlorianDahn
2019-03-27 14:01:48 +07:00
parent 5cd54fc746
commit b14fa2dc87
12 changed files with 348 additions and 19 deletions
+14 -12
View File
@@ -114,6 +114,7 @@ namespace TelegramBotBase.Sessions
try
{
var m = await this.Client.TelegramClient.EditMessageTextAsync(this.DeviceId, messageId, text, replyMarkup: markup);
return m;
}
catch
@@ -149,6 +150,8 @@ namespace TelegramBotBase.Sessions
try
{
m = await (this.Client.TelegramClient.SendTextMessageAsync(this.DeviceId, text, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification));
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
}
catch (ApiRequestException ex)
{
@@ -159,9 +162,6 @@ namespace TelegramBotBase.Sessions
return null;
}
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
return m;
}
@@ -183,6 +183,8 @@ namespace TelegramBotBase.Sessions
try
{
m = await (this.Client.TelegramClient.SendTextMessageAsync(this.DeviceId, text, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification));
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
}
catch (ApiRequestException ex)
{
@@ -193,8 +195,6 @@ namespace TelegramBotBase.Sessions
return null;
}
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
return m;
}
@@ -222,6 +222,8 @@ namespace TelegramBotBase.Sessions
try
{
m = await this.Client.TelegramClient.SendPhotoAsync(this.DeviceId, file, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification);
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
}
catch (ApiRequestException ex)
{
@@ -232,8 +234,6 @@ namespace TelegramBotBase.Sessions
return null;
}
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
return m;
}
@@ -318,7 +318,7 @@ namespace TelegramBotBase.Sessions
}
var m = await this.Client.TelegramClient.SendDocumentAsync(this.DeviceId, document, caption, replyMarkup: markup, disableNotification: disableNotification, replyToMessageId: replyTo);
OnMessageSent(new MessageSentEventArgs(m.MessageId, m));
return m;
@@ -339,11 +339,12 @@ namespace TelegramBotBase.Sessions
/// </summary>
/// <param name="buttonText"></param>
/// <param name="requestMessage"></param>
/// <param name="OneTimeOnly"></param>
/// <returns></returns>
public async Task<Message> RequestContact(String buttonText = "Send your contact", String requestMessage = "Give me your phone number!")
public async Task<Message> RequestContact(String buttonText = "Send your contact", String requestMessage = "Give me your phone number!", bool OneTimeOnly = true)
{
var rck = new ReplyKeyboardMarkup(KeyboardButton.WithRequestContact(buttonText));
rck.OneTimeKeyboard = OneTimeOnly;
return await this.Client.TelegramClient.SendTextMessageAsync(this.DeviceId, requestMessage, replyMarkup: rck);
}
@@ -352,11 +353,12 @@ namespace TelegramBotBase.Sessions
/// </summary>
/// <param name="buttonText"></param>
/// <param name="requestMessage"></param>
/// <param name="OneTimeOnly"></param>
/// <returns></returns>
public async Task<Message> RequestLocation(String buttonText = "Send your location", String requestMessage = "Give me your location!")
public async Task<Message> RequestLocation(String buttonText = "Send your location", String requestMessage = "Give me your location!", bool OneTimeOnly = true)
{
var rcl = new ReplyKeyboardMarkup(KeyboardButton.WithRequestLocation(buttonText));
rcl.OneTimeKeyboard = OneTimeOnly;
return await this.Client.TelegramClient.SendTextMessageAsync(this.DeviceId, requestMessage, replyMarkup: rcl);
}