-
Notifications
You must be signed in to change notification settings - Fork 5
Update Telegram Bot API version to 9.0 #82
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
niklasweimann
wants to merge
5
commits into
master
Choose a base branch
from
v9.0.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1114df3
Update Telegram Bot API version to 9.0
niklasweimann 28dd70e
Add Telegram Premium and General part of API v9.0
niklasweimann 4705d60
Add more business methods
niklasweimann b132b81
Add story management features and gift conversion methods
niklasweimann a80c2a7
Fix syntax error in DeleteStory method implementation
niklasweimann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/RxTelegram.Bot/Interface/BaseTypes/AccpetedGiftTypes.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace RxTelegram.Bot.Interface.BaseTypes; | ||
|
||
/// <summary> | ||
/// This object describes the types of gifts that can be gifted to a user or a chat. | ||
/// </summary> | ||
public class AccpetedGiftTypes | ||
{ | ||
/// <summary> | ||
/// True, if unlimited regular gifts are accepted | ||
/// </summary> | ||
public bool UnlimitedGifts { get; set; } | ||
|
||
/// <summary> | ||
/// True, if limited regular gifts are accepted | ||
/// </summary> | ||
public bool LimitedGifts { get; set; } | ||
|
||
/// <summary> | ||
/// True, if unique gifts or gifts that can be upgraded to unique for free are accepted | ||
/// </summary> | ||
public bool UniqueGifts { get; set; } | ||
|
||
/// <summary> | ||
/// True, if a Telegram Premium subscription is accepted | ||
/// </summary> | ||
public bool PremiumSubscription { get; set; } | ||
} |
7 changes: 7 additions & 0 deletions
7
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/Enums/InputProfilePhotoTypes.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
public enum InputProfilePhotoTypes | ||
{ | ||
Static, | ||
Animated | ||
} |
7 changes: 7 additions & 0 deletions
7
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/Enums/InputStoryContentTypes.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
public enum InputStoryContentTypes | ||
{ | ||
Photo, | ||
Video | ||
} |
11 changes: 11 additions & 0 deletions
11
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputProfilePhoto.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia; | ||
|
||
public interface InputProfilePhoto | ||
{ | ||
/// <summary> | ||
/// Type of the result | ||
/// </summary> | ||
public abstract InputProfilePhotoTypes Type { get; set; } | ||
} |
25 changes: 25 additions & 0 deletions
25
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputProfilePhotoAnimated.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
/// <summary> | ||
/// An animated profile photo in the MPEG4 format. | ||
/// </summary> | ||
public class InputProfilePhotoAnimated : InputProfilePhoto | ||
{ | ||
/// <summary> | ||
/// Type of the result | ||
/// </summary> | ||
public InputProfilePhotoTypes Type { get; set; } = InputProfilePhotoTypes.Animated; | ||
|
||
/// <summary> | ||
/// The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, | ||
/// so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. | ||
/// </summary> | ||
public string Animation { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. | ||
/// Timestamp in seconds of the frame that will be used as the static profile photo. | ||
/// Defaults to 0.0. | ||
/// </summary> | ||
public double FrameTimestamp { get; set; } = 0.0; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputProfilePhotoStatic.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia; | ||
|
||
/// <summary> | ||
/// A static profile photo in the .JPG format. | ||
/// </summary> | ||
public class InputProfilePhotoStatic : InputProfilePhoto | ||
{ | ||
/// <summary> | ||
/// Type of the profile photo, must be static | ||
/// </summary> | ||
public InputProfilePhotoTypes Type { get; set; } = InputProfilePhotoTypes.Static; | ||
|
||
/// <summary> | ||
/// The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, | ||
/// so you can pass “attach://file_attach_name” if the photo was uploaded using multipart/form-data under file_attach_name. | ||
/// </summary> | ||
public string Photo { get; set; } | ||
} |
11 changes: 11 additions & 0 deletions
11
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputStoryContent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia; | ||
|
||
public interface InputStoryContent | ||
{ | ||
/// <summary> | ||
/// Type of the result | ||
/// </summary> | ||
public abstract InputStoryContentTypes Type { get; set; } | ||
} |
18 changes: 18 additions & 0 deletions
18
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputStoryContentPhoto.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia; | ||
|
||
/// <summary> | ||
/// Describes a photo to post as a story. | ||
/// </summary> | ||
public class InputStoryContentPhoto : InputStoryContent | ||
{ | ||
public InputStoryContentTypes Type { get; set; } = InputStoryContentTypes.Photo; | ||
|
||
/// <summary> | ||
/// The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. | ||
/// The photo can't be reused and can only be uploaded as a new file, | ||
/// so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. | ||
/// </summary> | ||
public string Photo { get; set; } | ||
} |
34 changes: 34 additions & 0 deletions
34
src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputStoryContentVideo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using RxTelegram.Bot.Interface.BaseTypes.InputMedia.Enums; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.InputMedia; | ||
|
||
/// <summary> | ||
/// Describes a video to post as a story. | ||
/// </summary> | ||
public class InputStoryContentVideo : InputStoryContent | ||
{ | ||
public InputStoryContentTypes Type { get; set; } = InputStoryContentTypes.Video; | ||
|
||
/// <summary> | ||
/// The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, | ||
/// with key frames added each second in the MPEG4 format, and must not exceed 30 MB. | ||
/// The video can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” | ||
/// if the video was uploaded using multipart/form-data under <file_attach_name>. | ||
/// </summary> | ||
public string Video { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. Precise duration of the video in seconds; 0-60 | ||
/// </summary> | ||
public double Duration { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0. | ||
/// </summary> | ||
public double CoverFrameTimestamp { get; set; } = 0.0; | ||
|
||
/// <summary> | ||
/// Optional. Pass True if the video has no sound | ||
/// </summary> | ||
public bool NoSound { get; set; } = false; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes; | ||
|
||
/// <summary> | ||
/// Contains the list of gifts received and owned by a user or a chat. | ||
/// </summary> | ||
public class OwnedGifts | ||
{ | ||
/// <summary> | ||
/// The total number of gifts owned by the user or the chat | ||
/// </summary> | ||
public int TotalCount { get; set; } | ||
|
||
/// <summary> | ||
/// The list of gifts | ||
/// </summary> | ||
public List<OwnedGift> Gifts { get; set; } | ||
|
||
/// <summary> | ||
/// Offset for the next request. If empty, then there are no more results | ||
/// </summary> | ||
public string? NextOffset { get; set; } | ||
} |
11 changes: 11 additions & 0 deletions
11
src/RxTelegram.Bot/Interface/BaseTypes/Requests/Base/BaseBusinessRequest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using RxTelegram.Bot.Interface.Validation; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Base; | ||
|
||
public abstract class BaseBusinessRequest : BaseValidation | ||
{ | ||
/// <summary> | ||
/// Unique identifier for the target chat or username of the target channel (in the format @channelusername) | ||
/// </summary> | ||
public string BusinessConnectionId { get; set; } | ||
} |
47 changes: 47 additions & 0 deletions
47
src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/GiftPremiumSubscription.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Collections.Generic; | ||
using RxTelegram.Bot.Interface.BaseTypes.Enums; | ||
using RxTelegram.Bot.Interface.Validation; | ||
using RxTelegram.Bot.Validation; | ||
|
||
namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages; | ||
|
||
/// <summary> | ||
/// Gifts a Telegram Premium subscription to the given user. Returns True on success. | ||
/// </summary> | ||
public class GiftPremiumSubscription : BaseValidation | ||
{ | ||
/// <summary> | ||
/// Unique identifier of the target user who will receive a Telegram Premium subscription | ||
/// </summary> | ||
public long UserId { get; set; } | ||
|
||
/// <summary> | ||
/// Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12 | ||
/// </summary> | ||
public int MonthCount { get; set; } | ||
|
||
/// <summary> | ||
/// Number of Telegram Stars to pay for the Telegram Premium subscription; | ||
/// must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months | ||
/// </summary> | ||
public int StarCount { get; set; } | ||
|
||
/// <summary> | ||
/// Text that will be shown along with the service message about the subscription; 0-128 characters | ||
/// </summary> | ||
public string Text { get; set; } | ||
|
||
/// <summary> | ||
/// Mode for parsing entities in the text. See formatting options for more details. | ||
/// Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. | ||
/// </summary> | ||
public ParseMode TextParseMode { get; set; } | ||
|
||
/// <summary> | ||
/// A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. | ||
/// Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. | ||
/// </summary> | ||
public List<MessageEntity> TextEntities { get; set; } | ||
|
||
protected override IValidationResult Validate() => this.CreateValidation(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace RxTelegram.Bot.Interface.BaseTypes; | ||
|
||
/// <summary> | ||
/// Describes an amount of Telegram Stars. | ||
/// </summary> | ||
public class StarAmount | ||
{ | ||
/// <summary> | ||
/// Integer amount of Telegram Stars, rounded to 0; can be negative | ||
/// </summary> | ||
public int Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. The number of 1/1000000000 shares of Telegram Stars; | ||
/// from -999999999 to 999999999; can be negative if and only if amount is non-positive | ||
/// </summary> | ||
public int NanostarAmount { get; set; } | ||
} |
77 changes: 77 additions & 0 deletions
77
src/RxTelegram.Bot/Interface/Business/BusinessBotRights.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
namespace RxTelegram.Bot.Interface.Business; | ||
|
||
/// <summary> | ||
/// Represents the rights of a business bot. | ||
/// </summary> | ||
public class BusinessBotRights | ||
{ | ||
/// <summary> | ||
/// Optional. True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours | ||
/// </summary> | ||
public bool? CanReply { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can mark incoming private messages as read | ||
/// </summary> | ||
public bool? CanReadMessages { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can delete messages sent by the bot | ||
/// </summary> | ||
public bool? CanDeleteSentMessages { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can delete all private messages in managed chats | ||
/// </summary> | ||
public bool? CanDeleteAllMessages { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can edit the first and last name of the business account | ||
/// </summary> | ||
public bool? CanEditName { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can edit the bio of the business account | ||
/// </summary> | ||
public bool? CanEditBio { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can edit the profile photo of the business account | ||
/// </summary> | ||
public bool? CanEditProfilePhoto { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can edit the username of the business account | ||
/// </summary> | ||
public bool? CanEditUsername { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can change the privacy settings pertaining to gifts for the business account | ||
/// </summary> | ||
public bool? CanChangeGiftSettings { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can view gifts and the amount of Telegram Stars owned by the business account | ||
/// </summary> | ||
public bool? CanViewGiftsAndStars { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can convert regular gifts owned by the business account to Telegram Stars | ||
/// </summary> | ||
public bool? CanConvertGiftsToStars { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can transfer and upgrade gifts owned by the business account | ||
/// </summary> | ||
public bool? CanTransferAndUpgradeGifts { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts | ||
/// </summary> | ||
public bool? CanTransferStars { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. True, if the bot can post, edit and delete stories on behalf of the business account | ||
/// </summary> | ||
public bool? CanManageStories { get; set; } | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class name 'AccpetedGiftTypes' contains a typo. It should be 'AcceptedGiftTypes' (missing 'c').
Copilot uses AI. Check for mistakes.