Skip to content

Commit 4d3cd37

Browse files
Merge pull request #49 from RxTelegram/v7.6
V7.6
2 parents 5c2d91e + bbdd805 commit 4d3cd37

22 files changed

+351
-48
lines changed

.github/workflows/main.yml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
name: Build and test
22
on:
3-
push:
4-
branches:
5-
- '*'
6-
pull_request:
7-
branches:
8-
- '*'
3+
push:
4+
branches:
5+
- '*'
6+
pull_request:
7+
branches:
8+
- '*'
99
jobs:
10-
build:
11-
runs-on: ubuntu-latest
12-
timeout-minutes: 3
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v4
16-
- name: Build
17-
run: dotnet build --configuration Release
18-
- name: Test
19-
run: dotnet test --configuration Release --no-build
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 3
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Build
17+
run: dotnet build --configuration Release
18+
test:
19+
runs-on: ubuntu-latest
20+
needs: build
21+
timeout-minutes: 3
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Test
26+
run: dotnet test --configuration Release

.github/workflows/publish.yml

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
name: Publish to nuget.org
22
on:
3-
push:
4-
tags:
5-
- "v[0-9]+.[0-9]+.[0-9]+"
3+
workflow_run:
4+
workflows: ["Check code quality"]
5+
branches: ["v[0-9]+.[0-9]+.[0-9]+"]
6+
types:
7+
- completed
68
jobs:
7-
build:
8-
runs-on: ubuntu-latest
9-
timeout-minutes: 3
10-
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v4
13-
with:
14-
fetch-depth: 0
15-
- name: Verify commit exists in origin/master
16-
run: git branch --remote --contains | grep origin/master
17-
- name: Extract release notes
18-
run: |
19-
git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES
20-
- name: Set VERSION variable from tag
21-
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
22-
- name: Build
23-
run: dotnet build /warnaserror --configuration Release /p:Version=${VERSION}
24-
- name: Test
25-
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build
26-
- name: Pack
27-
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
28-
- name: Push nuget to nuget.org
29-
run: dotnet nuget push RxTelegram.Bot.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
9+
publish:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 3
12+
steps:
13+
- name: Download build result
14+
uses: actions/download-artifact@v4
15+
with:
16+
name: build
17+
- name: Set VERSION variable from tag
18+
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
19+
- name: Pack
20+
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
21+
- name: Push nuget to nuget.org
22+
run: dotnet nuget push RxTelegram.Bot.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json

.github/workflows/sonarqube.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Check code quality
2-
on: [ push, pull_request ]
2+
on:
3+
workflow_run:
4+
workflows: ["Build and test"]
5+
types:
6+
- completed
37
jobs:
4-
build:
5-
name: Build
8+
sonarqube:
9+
name: sonarqube
610
runs-on: windows-latest
711
steps:
812
- name: Set up JDK 17

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![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)
66
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=coverage)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)
77

8-
RxTelegram.Bot supports Telegram Bot API 7.5 (as at June 18, 2024).
8+
RxTelegram.Bot supports Telegram Bot API 7.6 (as at July 1, 2024).
99

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

src/RxTelegram.Bot/Interface/BaseTypes/ChatFullInfo.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ public class ChatFullInfo
183183
/// </summary>
184184
public ChatPermissions Permissions { get; set; }
185185

186+
/// <summary>
187+
/// Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.
188+
/// </summary>
189+
public bool CanSendPaidMedia { get; set; }
190+
186191
/// <summary>
187192
/// Optional. For supergroups, the minimum allowed delay between consecutive
188193
/// messages sent by each unprivileged user. Returned only in getChat.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using RxTelegram.Bot.Utils.MultiType;
2+
3+
namespace RxTelegram.Bot.Interface.BaseTypes.Enums;
4+
5+
public enum PaidMediaType
6+
{
7+
[ImplementationType(typeof(PaidMediaPreview))]
8+
Preview,
9+
10+
[ImplementationType(typeof(PaidMediaPhoto))]
11+
Photo,
12+
13+
[ImplementationType(typeof(PaidMediaVideo))]
14+
Video
15+
}

src/RxTelegram.Bot/Interface/BaseTypes/ExternalReplyInfo.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ public class ExternalReplyInfo
4646
/// </summary>
4747
public Document Document { get; set; }
4848

49+
/// <summary>
50+
/// Optional. Message contains paid media; information about the paid media
51+
/// </summary>
52+
public PaidMediaInfo PaidMedia { get; set; }
53+
4954
/// <summary>
5055
/// Optional. Message is a photo, available sizes of the photo
5156
/// </summary>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.InputPaidMedia.Enums;
2+
using RxTelegram.Bot.Utils.MultiType;
3+
4+
namespace RxTelegram.Bot.Interface.BaseTypes.InputPaidMedia;
5+
6+
public abstract class BaseInputPaidMedia : IMultiTypeClassByType<InputPaidMediaTypes>
7+
{
8+
public abstract InputPaidMediaTypes Type { get; set; }
9+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.InputPaidMedia.Enums;
2+
3+
namespace RxTelegram.Bot.Interface.BaseTypes.InputPaidMedia;
4+
5+
/// <summary>
6+
/// The paid media to send is a photo.
7+
/// </summary>
8+
public class BaseInputPaidMediaPhoto: BaseInputPaidMedia
9+
{
10+
/// <summary>
11+
/// Type of the media, must be photo
12+
/// </summary>
13+
public override InputPaidMediaTypes Type { get; set; } = InputPaidMediaTypes.Photo;
14+
15+
/// <summary>
16+
/// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended),
17+
/// pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one
18+
/// using multipart/form-data under <file_attach_name> name.
19+
/// </summary>
20+
public string Media { get; set; }
21+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.InputPaidMedia.Enums;
2+
using RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments;
3+
4+
namespace RxTelegram.Bot.Interface.BaseTypes.InputPaidMedia;
5+
6+
/// <summary>
7+
/// The paid media to send is a video.
8+
/// </summary>
9+
public class BaseInputPaidMediaVideo : BaseInputPaidMedia
10+
{
11+
/// <summary>
12+
/// Type of the media, must be video
13+
/// </summary>
14+
public override InputPaidMediaTypes Type { get; set; } = InputPaidMediaTypes.Video;
15+
16+
/// <summary>
17+
/// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to
18+
/// get a file from the Internet, or pass “attach://< file_attach_name >” to upload a new one using multipart/form-data
19+
/// under </file_attach_name > name.
20+
/// </summary>
21+
public string Media { get; set; }
22+
23+
/// <summary>
24+
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should
25+
/// be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is
26+
/// not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can
27+
/// pass “attach://{file_attach_name}” if the thumbnail was uploaded using multipart/form-data under {file_attach_name}.
28+
/// </summary>
29+
public InputFile Thumbnail { get; set; }
30+
31+
/// <summary>
32+
/// Optional. Video width
33+
/// </summary>
34+
public int Width { get; set; }
35+
36+
/// <summary>
37+
/// Optional. Video height
38+
/// </summary>
39+
public int Height { get; set; }
40+
41+
/// <summary>
42+
/// Optional. Video duration in seconds
43+
/// </summary>
44+
public int Duration { get; set; }
45+
46+
/// <summary>
47+
/// Optional. Pass True if the uploaded video is suitable for streaming
48+
/// </summary>
49+
public bool SupportsStreaming { get; set; }
50+
}

0 commit comments

Comments
 (0)