Skip to content

Commit 33ebb8d

Browse files
authored
Merge pull request #1028 from TelegramBots/develop
Implement Bot API v5.4
2 parents e3e812b + 049c704 commit 33ebb8d

56 files changed

Lines changed: 3363 additions & 1308 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.azure-pipelines/variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ variables:
33
- name: versionPrefix
44
value: 17.0.0
55
- name: versionSuffix
6-
value: "alpha.3"
6+
value: "alpha.4"
77
- name: ciVersionSuffix
88
value: ci.$(Build.BuildId)+git.commit.$(Build.SourceVersion)
99
- name: buildConfiguration

.devcontainer/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ARG DOTNET_VERSION=5.0
2+
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-buster-slim
3+
ARG USERNAME=vscode
4+
ARG USER_UID=1000
5+
ARG USER_GID=${USER_UID}
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
# Install required and misc tools
9+
RUN apt-get update && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
10+
&& apt-get -y install openssh-client less iproute2 apt-transport-https gnupg2 curl lsb-release \
11+
git procps ca-certificates vim nano groff zip file jq wget zsh \
12+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
13+
&& groupadd --gid $USER_GID $USERNAME \
14+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
15+
# [Optional] Add sudo support for the non-root user
16+
&& apt-get install -y sudo \
17+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
18+
&& chmod 0440 /etc/sudoers.d/$USERNAME
19+
20+
# Cleanup APT
21+
RUN apt-get autoremove -y \
22+
&& apt-get clean -y \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
RUN chsh -s $(which zsh) ${USERNAME}
26+
USER ${USERNAME}
27+
28+
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
29+
# This is needed for Global Tools to work
30+
ENV PATH="${PATH}:/home/${USERNAME}/.dotnet/tools"
31+
# Install .NET Global Tools
32+
RUN dotnet tool install -g dotnet-format \
33+
&& dotnet tool install -g microsoft.dotnet-httprepl
34+
35+
ENV DEBIAN_FRONTEND=dialog
36+
37+
WORKDIR /workspace

.devcontainer/devcontainer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Telegram.Bot",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "devhost",
5+
"shutdownAction": "stopCompose",
6+
"workspaceFolder": "/workspace",
7+
"extensions": [
8+
"ms-dotnettools.csharp",
9+
"ms-azuretools.vscode-docker",
10+
"editorconfig.editorconfig",
11+
"eamodio.gitlens",
12+
"tintoy.msbuild-project-tools",
13+
"logerfo.sln-support",
14+
"formulahendry.dotnet-test-explorer"
15+
],
16+
"remoteUser": "vscode"
17+
}

.devcontainer/docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
services:
3+
devhost:
4+
user: vscode
5+
build: .
6+
environment:
7+
- DOTNET_ENVIRONMENT=Development
8+
- DOTNET_NOLOGO=1
9+
volumes:
10+
- ..:/workspace
11+
- ./persistence/nuget:/vscode/.nuget
12+
command: sleep infinity

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,3 @@ src/Telegram.Bot.Documentation/
212212

213213
# Rider IDE
214214
.idea
215-
216-
# VS Code
217-
.vscode/

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
2323

2424
## [Unreleased]
2525

26+
### Added
27+
- Request `ApproveChatJoinRequest`
28+
- Request `DeclineChatJoinRequest`
29+
- Property `bool? CreateChatInviteLinkRequest.CreatesJoinRequest`
30+
- Property `string? CreateChatInviteLinkRequest.Name`
31+
- Property `bool? EditChatInviteLinkRequest.CreatesJoinRequest`
32+
- Property `string? EditChatInviteLinkRequest.Name`
33+
- Property `bool ChatInviteLink.CreatesJoinRequest`
34+
- Property `int? ChatInviteLink.PendingJoinRequestCount`
35+
- Type `ChatJoinRequest`
36+
- Property `ChatJoinRequest Update.ChatJoinRequest`
37+
- Enum member `ChatAction.ChooseSticker`
38+
- Extension method `TelegramBotClientExtensions.ApproveChatJoinRequestAsync`
39+
- Extension method `TelegramBotClientExtensions.DeclineChatJoinRequestAsync`
40+
41+
### Changed
42+
- Extension method `TelegramBotClientExtensions.EditChatInviteLinkAsync`:
43+
- Added parameters `string? name` and `bool? createsJoinRequest`
44+
- Extension method `TelegramBotClientExtensions.CreateChatInviteLinkAsync`:
45+
- Added parameters `string? name` and `bool? createsJoinRequest`
46+
47+
### Changed
48+
- Fields `ChatId.Identifier` and `ChatId.Username` changed into get-only properties
49+
50+
## [v17.0.0-alpha.3] - 2021-09-01
51+
2652
### Changed
2753
- Method `GetInfoAndDownloadFileAsync` moved into static class `TelegramBotClientExtensions` as an extension method
2854
- Symbols are always include in the package

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# .NET Client for Telegram Bot API
22

33
[![package](https://img.shields.io/nuget/vpre/Telegram.Bot.svg?label=Telegram.Bot&style=flat-square)](https://www.nuget.org/packages/Telegram.Bot)
4-
[![Bot API Version](https://img.shields.io/badge/Bot%20API-5.2%20(June%2025,%202021)-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
4+
[![Bot API Version](https://img.shields.io/badge/Bot%20API-5.4%20(November%205,%202021)-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
55
[![documentations](https://img.shields.io/badge/Documentations-Book-orange.svg?style=flat-square)](https://telegrambots.github.io/book/)
66
[![telegram chat](https://img.shields.io/badge/Support_Chat-Telegram-blue.svg?style=flat-square)](https://t.me/joinchat/B35YY0QbLfd034CFnvCtCA)
77

Telegram.Bot.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2121
README.md = README.md
2222
EndProjectSection
2323
EndProject
24+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".azure-pipelines", ".azure-pipelines", "{71662597-40F2-4192-AC4D-5FB9A1F12642}"
25+
ProjectSection(SolutionItems) = preProject
26+
.azure-pipelines\ci.yml = .azure-pipelines\ci.yml
27+
.azure-pipelines\default-pipeline.yml = .azure-pipelines\default-pipeline.yml
28+
.azure-pipelines\develop-pipeline.yml = .azure-pipelines\develop-pipeline.yml
29+
.azure-pipelines\manual-pipeline.yml = .azure-pipelines\manual-pipeline.yml
30+
.azure-pipelines\release-pipeline.yml = .azure-pipelines\release-pipeline.yml
31+
.azure-pipelines\setVersionVariables.js = .azure-pipelines\setVersionVariables.js
32+
.azure-pipelines\variables.yml = .azure-pipelines\variables.yml
33+
EndProjectSection
34+
EndProject
35+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "jobs", "jobs", "{C20A563E-603B-49E8-A954-DB90D4F351DE}"
36+
ProjectSection(SolutionItems) = preProject
37+
.azure-pipelines\jobs\run-integration-tests.yml = .azure-pipelines\jobs\run-integration-tests.yml
38+
.azure-pipelines\jobs\run-unit-tests.yml = .azure-pipelines\jobs\run-unit-tests.yml
39+
EndProjectSection
40+
EndProject
41+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".devcontainer", ".devcontainer", "{4897F36C-2F57-48A7-B425-D8F695E0AC0D}"
42+
ProjectSection(SolutionItems) = preProject
43+
.devcontainer\devcontainer.json = .devcontainer\devcontainer.json
44+
.devcontainer\docker-compose.yml = .devcontainer\docker-compose.yml
45+
.devcontainer\Dockerfile = .devcontainer\Dockerfile
46+
EndProjectSection
47+
EndProject
2448
Global
2549
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2650
Debug|Any CPU = Debug|Any CPU
@@ -47,6 +71,9 @@ Global
4771
{12FD39CD-A6FD-4040-8C8B-8FABEDD5FE0F} = {838231A4-B081-44B0-AC16-DC4C2FABAE86}
4872
{B662E909-CF8B-47C6-BAA8-FCA595BA53EA} = {15F0DD71-1D15-4085-AF6F-E3E5D8ACB489}
4973
{AAB9E3BA-D749-4D38-9021-EBD8D0BC8975} = {15F0DD71-1D15-4085-AF6F-E3E5D8ACB489}
74+
{71662597-40F2-4192-AC4D-5FB9A1F12642} = {C45387C6-C93F-4FD2-84A8-A69CCE93B7EE}
75+
{C20A563E-603B-49E8-A954-DB90D4F351DE} = {71662597-40F2-4192-AC4D-5FB9A1F12642}
76+
{4897F36C-2F57-48A7-B425-D8F695E0AC0D} = {C45387C6-C93F-4FD2-84A8-A69CCE93B7EE}
5077
EndGlobalSection
5178
GlobalSection(ExtensibilityGlobals) = postSolution
5279
SolutionGuid = {F6A9C4CA-DF26-4772-9119-627935D70E7C}

src/Telegram.Bot/AsyncEventHandler`T.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
namespace Telegram.Bot
77
{
8+
#pragma warning disable CA1711
89
public delegate ValueTask AsyncEventHandler<in TArgs>(
10+
#pragma warning restore CA1711
911
ITelegramBotClient botClient,
1012
TArgs args,
1113
CancellationToken cancellationToken = default

src/Telegram.Bot/Converters/BanTimeUnixDateTimeConverter.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,18 @@ namespace Telegram.Bot.Converters
66
{
77
internal class BanTimeUnixDateTimeConverter : UnixDateTimeConverter
88
{
9-
static readonly DateTime DefaultUtc = DateTime.SpecifyKind(default, DateTimeKind.Utc);
10-
119
public override object? ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
1210
{
1311
var nonNullable = Nullable.GetUnderlyingType(objectType) is null;
1412

15-
if (reader.TokenType == JsonToken.Integer && reader.Value is 0L)
16-
{
17-
return nonNullable ? DefaultUtc : null;
18-
}
19-
20-
return base.ReadJson(reader, objectType, existingValue, serializer);
13+
return reader.TokenType == JsonToken.Integer && reader.Value is 0L
14+
? nonNullable ? default : null
15+
: base.ReadJson(reader, objectType, existingValue, serializer);
2116
}
2217

2318
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
2419
{
25-
if (value is null || value.Equals(DefaultUtc))
20+
if (value is null || value.Equals(default(DateTime)))
2621
{
2722
writer.WriteValue(0);
2823
}

0 commit comments

Comments
 (0)