Skip to content

Commit

Permalink
Merge pull request #58 from RxTelegram/v7.11
Browse files Browse the repository at this point in the history
Add support for api v7.11
  • Loading branch information
niklasweimann authored Nov 6, 2024
2 parents f19731c + a245bfa commit 6904aea
Show file tree
Hide file tree
Showing 26 changed files with 179 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![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.10 (as at September 6, 2024).
RxTelegram.Bot supports Telegram Bot API 7.11 (as at October 31, 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
12 changes: 12 additions & 0 deletions src/RxTelegram.Bot/Interface/BaseTypes/CopyTextButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace RxTelegram.Bot.Interface.BaseTypes;

/// <summary>
/// This object represents an inline keyboard button that copies specified text to the clipboard.
/// </summary>
public class CopyTextButton
{
/// <summary>
/// The text to be copied to the clipboard; 1-256 characters
/// </summary>
public string Text { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ public enum TransactionPartnerType


[ImplementationType(typeof(TransactionPartnerOther))]
Other
Other,

[ImplementationType(typeof(TransactionPartnerTelegramApi))]
TelegramApi
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public class InlineKeyboardButton
/// </summary>
public string SwitchInlineQueryCurrentChat { get; set; }

/// <summary>
/// Optional. Description of the button that copies the specified text to the clipboard.
/// </summary>
public CopyTextButton CopyTextButton { get; set; }

/// <summary>
/// Optional. Description of the game that will be launched when the user presses the button.
/// NOTE: This type of button must always be the first button in the first row.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned.
/// Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
/// </summary>
public class SendAnimation : BaseSend, IProtectContent
public class SendAnimation : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -87,4 +87,10 @@ public class SendAnimation : BaseSend, IProtectContent
public bool? ProtectContent { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// limit may be changed in the future.
/// For sending voice messages, use the sendVoice method instead.
/// </summary>
public class SendAudio : BaseSend, IProtectContent
public class SendAudio : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -79,4 +79,10 @@ public class SendAudio : BaseSend, IProtectContent
public bool? ProtectContent { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// <summary>
/// Use this method to send phone contacts. On success, the sent Message is returned.
/// </summary>
public class SendContact : BaseRequest, IProtectContent
public class SendContact : BaseRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -69,5 +69,11 @@ public class SendContact : BaseRequest, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;

public class SendDocument : BaseSend, IProtectContent
public class SendDocument : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -53,4 +53,10 @@ public class SendDocument : BaseSend, IProtectContent
public bool? ProtectContent { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;

public class SendLocation : BaseRequest, IProtectContent
public class SendLocation : BaseRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -75,5 +75,11 @@ public class SendLocation : BaseRequest, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;

public class SendMediaGroup : BaseRequest, IProtectContent
public class SendMediaGroup : BaseRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -43,5 +43,11 @@ public class SendMediaGroup : BaseRequest, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;

public class SendPhoto : BaseSend, IProtectContent
public class SendPhoto : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -53,4 +53,10 @@ public class SendPhoto : BaseSend, IProtectContent
public bool? ProtectContent { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// <summary>
/// Use this method to send a native poll. On success, the sent Message is returned.
/// </summary>
public class SendPoll : BaseRequest, IProtectContent
public class SendPoll : BaseRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -128,5 +128,11 @@ public class SendPoll : BaseRequest, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// <summary>
/// Use this method to send information about a venue. On success, the sent Message is returned.
/// </summary>
public class SendVenue : BaseRequest, IProtectContent
public class SendVenue : BaseRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -93,5 +93,11 @@ public class SendVenue : BaseRequest, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the
/// sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
/// </summary>
public class SendVideo : BaseSend, IProtectContent
public class SendVideo : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -90,4 +90,10 @@ public class SendVideo : BaseSend, IProtectContent
public bool? ProtectContent { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages.
/// On success, the sent Message is returned.
/// </summary>
public class SendVideoNote : BaseSend, IProtectContent
public class SendVideoNote : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -59,5 +59,11 @@ public class SendVideoNote : BaseSend, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
/// your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message
/// is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
/// </summary>
public class SendVoice : BaseSend, IProtectContent
public class SendVoice : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -56,5 +56,11 @@ public class SendVoice : BaseSend, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Base.Interfaces;

public interface IAllowPaidBroadcast
{
/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
/// Use this method to copy messages of any kind. The method is analogous to the method forwardMessages,
/// but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
/// </summary>
public class CopyMessage : BaseSend, IProtectContent
public class CopyMessage : BaseSend, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
Expand Down Expand Up @@ -54,5 +54,11 @@ public class CopyMessage : BaseSend, IProtectContent
/// </summary>
public bool ShowCaptionAboveMedia { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
/// Use this method to send a dice, which will have a random value from 1 to 6. On success, the sent Message is returned.
/// (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
/// </summary>
public class SendDice : BaseRequest, IProtectContent
public class SendDice : BaseRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -52,5 +52,11 @@ public class SendDice : BaseRequest, IProtectContent
/// </summary>
public bool? ProtectContent { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;

public class SendMessage : BaseTextRequest, IProtectContent
public class SendMessage : BaseTextRequest, IProtectContent, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -62,4 +62,10 @@ public class SendMessage : BaseTextRequest, IProtectContent
public bool? ProtectContent { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
/// <summary>
/// Use this method to send paid media to channel chats. On success, the sent Message is returned.
/// </summary>
public class SendPaidMedia : BaseTextRequest
public class SendPaidMedia : BaseTextRequest, IAllowPaidBroadcast
{
/// <summary>
/// Unique identifier of the business connection on behalf of which the message will be sent
Expand Down Expand Up @@ -69,5 +69,11 @@ public class SendPaidMedia : BaseTextRequest
/// </summary>
public IReplyMarkup ReplyMarkup { get; set; }

/// <summary>
/// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
/// The relevant Stars will be withdrawn from the bot's balance
/// </summary>
public bool? AllowPaidBroadcast { get; set; }

protected override IValidationResult Validate() => this.CreateValidation();
}
Loading

0 comments on commit 6904aea

Please sign in to comment.