FlorianDahn 31e52887ba V17 - Big Update
- Adding a message loop interface to build custom message loops
- extracting default message loop from BotBase into seperate class
- updates to BotBaseBuilder for integration of custom message loops
- updating all result classes for using the new Update object of V17
- improving MessageResult and UpdateResult classes
- BotBase has been prepared for cleanup (a lot of comments)
- Comment cleanup at the next build
- updating Readme
2021-11-26 17:57:49 +01:00

55 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot;
namespace TelegramBotBase.Base
{
public class ResultBase : EventArgs
{
public MessageClient Client { get; set; }
public virtual long DeviceId { get; set; }
public int MessageId
{
get
{
return this.Message.MessageId;
}
}
public virtual Telegram.Bot.Types.Message Message { get; set; }
/// <summary>
/// Deletes the current message
/// </summary>
/// <param name="messageId"></param>
/// <returns></returns>
public virtual async Task DeleteMessage()
{
await DeleteMessage(this.MessageId);
}
/// <summary>
///Deletes the current message or the given one.
/// </summary>
/// <param name="messageId"></param>
/// <returns></returns>
public virtual async Task DeleteMessage(int messageId = -1)
{
try
{
await this.Client.TelegramClient.DeleteMessageAsync(this.DeviceId, (messageId == -1 ? this.MessageId : messageId));
}
catch
{
}
}
}
}