Skip to content
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

Add support for v7.3 #43

Merged
merged 6 commits into from
May 20, 2024
Merged
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
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
| WARNING: Be careful when installing RxTelegram.Bot. DO NOT INSTALL RxTelegram.Bot2. Since RxTelegram.Bot2 does not send your Requests to the official Telegram API and can read your entire traffic. |
| --- |
# RxTelegram.Bot

[![NuGet](http://img.shields.io/nuget/v/RxTelegram.Bot.svg)](https://www.nuget.org/packages/RxTelegram.Bot)
[![Downloads](https://img.shields.io/nuget/dt/RxTelegram.Bot.svg)](https://www.nuget.org/packages/RxTelegram.Bot)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=coverage)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)

RxTelegram.Bot supports Telegram Bot API 7.2 (as at March 31, 2024).
RxTelegram.Bot supports Telegram Bot API 7.3 (as at May 6, 2024).

This is a reactive designed .NET Library for the Telegram Bot API. It works with the official [Reactive Extentions](https://github.com/dotnet/reactive).

Expand Down
86 changes: 66 additions & 20 deletions src/RxTelegram.Bot/ITelegramBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ public interface ITelegramBot
/// <param name="editMessageLiveLocation">Details for the live location to edit.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>On success, if the edited message was sent by the bot, the edited <see cref="Message" /> is returned, otherwise True is returned.</returns>
Task<Message> EditMessageLiveLocation(EditMessageLiveLocation editMessageLiveLocation, CancellationToken cancellationToken = default);
Task<Message> EditMessageLiveLocation(
EditMessageLiveLocation editMessageLiveLocation,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to get up to date information about the chat (current name of the user for one-on-one conversations,
Expand All @@ -194,7 +196,7 @@ public interface ITelegramBot
/// <param name="getChat">ChatId for the request.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns a <see cref="Chat" /> object on success.</returns>
Task<Chat> GetChat(GetChat getChat, CancellationToken cancellationToken = default);
Task<ChatFullInfo> GetChat(GetChat getChat, CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to get information about a member of a chat.
Expand All @@ -218,7 +220,9 @@ public interface ITelegramBot
/// <param name="getUserProfilePhotos">Filter for the requested username.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns a <see cref="UserProfilePhotos" /> object.</returns>
Task<UserProfilePhotos> GetUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos, CancellationToken cancellationToken = default);
Task<UserProfilePhotos> GetUserProfilePhotos(
GetUserProfilePhotos getUserProfilePhotos,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to get a list of administrators in a chat.
Expand Down Expand Up @@ -376,7 +380,9 @@ Task<IEnumerable<ChatMember>> GetChatAdministrators(
/// <param name="setStickerSetThumbnail">Sets the thumbnail picture for the sticker set.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> SetStickerSetThumbnail(SetStickerSetThumbnail setStickerSetThumbnail, CancellationToken cancellationToken = default);
Task<bool> SetStickerSetThumbnail(
SetStickerSetThumbnail setStickerSetThumbnail,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to send static .WEBP or animated .TGS stickers.
Expand Down Expand Up @@ -461,7 +467,9 @@ Task<IEnumerable<ChatMember>> GetChatAdministrators(
/// <param name="setStickerPositionInSet">Details for the sticker that should be repositioned in the sticker set.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> SetStickerPositionInSet(SetStickerPositionInSet setStickerPositionInSet, CancellationToken cancellationToken = default);
Task<bool> SetStickerPositionInSet(
SetStickerPositionInSet setStickerPositionInSet,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method when you need to tell the user that something is happening on the bot's side.
Expand Down Expand Up @@ -538,15 +546,19 @@ Task<bool> SetChatAdministratorCustomTitle(
/// Will return the score of the specified user and several of their neighbors in a game.
/// On success, returns an Array of GameHighScore objects.
/// </returns>
Task<IEnumerable<GameHighScore>> GetGameHighScores(GetGameHighScores getGameHighScores, CancellationToken cancellationToken = default);
Task<IEnumerable<GameHighScore>> GetGameHighScores(
GetGameHighScores getGameHighScores,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to stop updating a live location message before live_period expires.
/// </summary>
/// <param name="stopMessageLiveLocation">MessageId of the liveLocation that should be stopped.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.</returns>
Task<Message> StopMessageLiveLocation(StopMessageLiveLocation stopMessageLiveLocation, CancellationToken cancellationToken = default);
Task<Message> StopMessageLiveLocation(
StopMessageLiveLocation stopMessageLiveLocation,
CancellationToken cancellationToken = default);

Task<bool> StopMessageLiveLocationInlineMessage(
StopMessageLiveLocation stopMessageLiveLocation,
Expand Down Expand Up @@ -618,7 +630,9 @@ Task<bool> StopMessageLiveLocationInlineMessage(
/// <param name="editMessageReplyMarkup">New reply markup for the message.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.</returns>
Task<Message> EditMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, CancellationToken cancellationToken = default);
Task<Message> EditMessageReplyMarkup(
EditMessageReplyMarkup editMessageReplyMarkup,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to send invoices.
Expand All @@ -645,7 +659,9 @@ Task<bool> StopMessageLiveLocationInlineMessage(
/// <param name="answerPreCheckoutQuery">Answer for the preCheckoutQuery</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>On success, True is returned.</returns>
Task<bool> AnswerPreCheckoutQuery(AnswerPreCheckoutQuery answerPreCheckoutQuery, CancellationToken cancellationToken = default);
Task<bool> AnswerPreCheckoutQuery(
AnswerPreCheckoutQuery answerPreCheckoutQuery,
CancellationToken cancellationToken = default);

/// <summary>
/// Informs a user that some of the Telegram Passport elements they provided contains errors.
Expand Down Expand Up @@ -765,7 +781,9 @@ Task<bool> StopMessageLiveLocationInlineMessage(
/// <param name="createChatInviteLink">Details for the chat invite link to create.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns the new invite link as <see cref="ChatInviteLink"/>.</returns>
Task<ChatInviteLink> CreateChatInviteLink(CreateChatInviteLink createChatInviteLink, CancellationToken cancellationToken = default);
Task<ChatInviteLink> CreateChatInviteLink(
CreateChatInviteLink createChatInviteLink,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to edit a non-primary invite link created by the bot.
Expand All @@ -784,7 +802,9 @@ Task<bool> StopMessageLiveLocationInlineMessage(
/// <param name="revokeChatInviteLink">Details for the invite link to revoke.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns the revoked invite link as <see cref="ChatInviteLink"/> object.</returns>
Task<ChatInviteLink> RevokeChatInviteLink(RevokeChatInviteLink revokeChatInviteLink, CancellationToken cancellationToken = default);
Task<ChatInviteLink> RevokeChatInviteLink(
RevokeChatInviteLink revokeChatInviteLink,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to approve a chat join request.
Expand All @@ -793,7 +813,9 @@ Task<bool> StopMessageLiveLocationInlineMessage(
/// <param name="approveChatJoinRequest">Join request to approve</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> ApproveChatJoinRequest(ApproveChatJoinRequest approveChatJoinRequest, CancellationToken cancellationToken = default);
Task<bool> ApproveChatJoinRequest(
ApproveChatJoinRequest approveChatJoinRequest,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to decline a chat join request.
Expand All @@ -802,7 +824,9 @@ Task<bool> StopMessageLiveLocationInlineMessage(
/// <param name="declineChatJoinRequest">Join request to decline</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> DeclineChatJoinRequest(DeclineChatJoinRequest declineChatJoinRequest, CancellationToken cancellationToken = default);
Task<bool> DeclineChatJoinRequest(
DeclineChatJoinRequest declineChatJoinRequest,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to ban a channel chat in a supergroup or a channel.
Expand Down Expand Up @@ -876,7 +900,9 @@ Task<ChatAdministratorRights> GetMyDefaultAdministratorRights(
/// <param name="getCustomEmojiStickers">Sticker ids to get</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns an Array of Sticker objects.</returns>
Task<Sticker[]> GetCustomEmojiStickers(GetCustomEmojiStickers getCustomEmojiStickers, CancellationToken cancellationToken = default);
Task<Sticker[]> GetCustomEmojiStickers(
GetCustomEmojiStickers getCustomEmojiStickers,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to create a topic in a forum supergroup chat.
Expand Down Expand Up @@ -960,7 +986,9 @@ Task<bool> UnpinAllForumTopicMessages(
/// <param name="closeGeneralForumTopic">General Forum Topic to close</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> CloseGeneralForumTopic(CloseGeneralForumTopic closeGeneralForumTopic, CancellationToken cancellationToken = default);
Task<bool> CloseGeneralForumTopic(
CloseGeneralForumTopic closeGeneralForumTopic,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to reopen a closed 'General' topic in a forum supergroup chat.
Expand All @@ -970,7 +998,9 @@ Task<bool> UnpinAllForumTopicMessages(
/// <param name="reopenGeneralForumTopic">General forum topic to reopen</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> ReopenGeneralForumTopic(ReopenGeneralForumTopic reopenGeneralForumTopic, CancellationToken cancellationToken = default);
Task<bool> ReopenGeneralForumTopic(
ReopenGeneralForumTopic reopenGeneralForumTopic,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to hide the 'General' topic in a forum supergroup chat.
Expand All @@ -989,7 +1019,9 @@ Task<bool> UnpinAllForumTopicMessages(
/// <param name="unhideGeneralForumTopic">General Forum topic to unhide</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> UnhideGeneralForumTopic(UnhideGeneralForumTopic unhideGeneralForumTopic, CancellationToken cancellationToken = default);
Task<bool> UnhideGeneralForumTopic(
UnhideGeneralForumTopic unhideGeneralForumTopic,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
Expand Down Expand Up @@ -1077,7 +1109,9 @@ Task<bool> SetCustomEmojiStickerSetThumbnail(
/// <param name="setStickerMaskPosition">Mask position to set for a sticker</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> SetStickerMaskPosition(SetStickerMaskPosition setStickerMaskPosition, CancellationToken cancellationToken = default);
Task<bool> SetStickerMaskPosition(
SetStickerMaskPosition setStickerMaskPosition,
CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to change the bot's name.
Expand Down Expand Up @@ -1131,8 +1165,8 @@ Task<bool> UnpinAllGeneralForumTopicMessages(
/// </summary>
/// <param name="forwardMessages">MessageIds to forward</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> ForwardMessages(ForwardMessages forwardMessages, CancellationToken cancellationToken = default);
/// <returns>On success, an array of<see cref="MessageIdObject"/> with the send messages is returned.</returns>
Task<MessageIdObject[]> ForwardMessages(ForwardMessages forwardMessages, CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat.
Expand Down Expand Up @@ -1161,4 +1195,16 @@ Task<BusinessConnection> GetBusinessConnection(
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns True on success.</returns>
Task<bool> ReplaceStickerInSet(ReplaceStickerInSet replaceStickerInSet, CancellationToken cancellationToken = default);

/// <summary>
/// Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped.
/// Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
/// A quiz poll can be copied only if the value of the field correct_option_id is known to the bot.
/// The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message.
/// Album grouping is kept for copied messages.
/// </summary>
/// <param name="copyMessages">Information about the messages to copy</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns>Returns an array of <see cref="MessageIdObject"/> on success.</returns>
Task<MessageIdObject[]> CopyMessages(CopyMessages copyMessages, CancellationToken cancellationToken = default);
}
Loading