Skip to content

DeleteMessage #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions NetTelegramBotApi/Requests/DeleteMessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Collections.Generic;
using System.Net.Http;

namespace NetTelegramBotApi.Requests
{
/// <summary>
/// Use this method to delete chat message.
/// On success, True is returned.
/// </summary>
public class DeleteMessage : RequestBase<bool>
{
public DeleteMessage(long chatId, long messageId)
: base("deleteMessage")
{
this.ChatId = chatId;
this.MessageId = messageId;
}

/// <summary>
/// Unique identifier for the target chat
/// </summary>
public long? ChatId { get; protected set; }

/// <summary>
/// Identifier of the message
/// </summary>
public long? MessageId { get; protected set; }

public override HttpContent CreateHttpContent()
{
var dic = new Dictionary<string, string>();
if (MessageId.HasValue)
{
dic.Add("chat_id", ChatId.ToString());
}

if (MessageId.HasValue)
{
dic.Add("message_id", MessageId.ToString());
}

return new FormUrlEncodedContent(dic);
}
}
}
7 changes: 7 additions & 0 deletions NetTelegramBotApi/Types/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public class User
/// </summary>
public string FirstName { get; set; }

/// <summary>
/// User‘s or bot’s
/// </summary>
public bool IsBot { get; set; }

/// <summary>
/// Optional. User‘s or bot’s last name
/// </summary>
Expand All @@ -26,5 +31,7 @@ public class User
/// Optional. User‘s or bot’s username
/// </summary>
public string Username { get; set; }


}
}