Skip to content

Commit

Permalink
updated some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Jul 17, 2024
1 parent 2dfa291 commit dd9b6a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 67 deletions.
41 changes: 9 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Changelog
## [v21.*] - 2024-06-22

Starting with version 21.x, changes are documented here:
https://telegrambots.github.io/book/Migration-Guide-to-Version-21.x.html

We keep this library updated to the latest version of Telegram Bot API.
See the [latest changes to Bot API here](https://core.telegram.org/bots/api#recent-changes)


<!--
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).
<!--
## [Unreleased]
Expand All @@ -21,36 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

<!-- markdownlint-configure-file { "MD024": false } -->

## [v21.1.0] - 2024-06-23

### [Bot API 7.5](https://core.telegram.org/bots/api#june-18-2024)
Added GetStarTransactions method, and parameter BusinessConnectionId on various requests.

## [v21.0.0] - 2024-06-22

### Rationalization of the library

These changes are aimed at making your life simpler and should not break existing code and instead ease the migration from previous versions:

- `ReplyParameters`: just pass an `int` when you just want to reply to a message
_(so the new replyParameters: parameter behaves the same as the old replyToMessageId: parameter)_
- `LinkPreviewOptions`: just pass a `bool` (true) to disable link preview
_(so the new linkPreviewOptions: parameter behaves the same as the old disableWebPagePreview: parameter)_
- `InputFile`: just pass a `string`/`Stream` for file_id/url/stream content _(as was possible in previous versions of Telegram.Bot)_
- `InputMedia*`: just pass an `InputFile` when you don't need to associate caption or such
- `MessageId`: auto-converts to/from `int` (and also from `Message`)
- `ReactionType`: just pass a `string` when you want to send an emoji
- `ReactionType`: just pass a `long` when you want to send a custom emoji (id)
- Some other obvious implicit conversion operators for structures containing a single property
- No more enforcing `init;` properties, so you can adjust the content of fields as you wish or modify a structure returned by the API _(before passing it back to the API if you want)_
- Not using the annoying `MaybeInaccessibleMessage`, you would just get a `Message` of type Unknown with Date==default if inaccessible
- Removed many [Obsolete] tags for things that still simplify your code
- Turned many `bool?` into normal `bool` (`false` is the same as `null`)
- Turned `ParseMode?` back into `ParseMode` (using `default` or `ParseMode.None` when unset)
- Restored some `MessageType` enum value that were removed (renamed) recently (easier compatibility)
- Recently added methods based on request structures are now obsolete and will be removed soon. Favor parameter-based methods instead.
If you already changed your code to use these structures and don't want to switch back, you can still use the `MakeRequestAsync` method to send them.

## [v20.0.0] - 2024-06-15

> [Bot API 7.0](https://core.telegram.org/bots/api#december-29-2023) (December 29, 2023)
Expand Down
35 changes: 2 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,15 @@ Before creating a pull request, make sure that your PR
- Has the HEAD commit from `develop` branch
- Has a clear message saying why this PR
- References/Explains any related issues
- Has updated changelog in `CHANGELOG.md` file

## Tests

Unit Tests and Systems Integration Tests are meant to be examples for our users of how to interact with the Bot API. It is necessary for test methods to be highly readable, clear on their intents, and show expected behaviour of both systems.

If commits in PR contain any changes to tests, ensure:

- Types are explicitly declared (no use of `var` keyword).
- If possible, method calls to `ITelegramBotClient` have argument names explicitly mentioned

## Code Style

### Bot API Requests

All requests to Telegram Bot API are represented by classes derived from `RequestBase<TResult>`. Required properties of a request must be get-only with value assigned in the constructor.
All requests to Telegram Bot API are represented by classes derived from `RequestBase<TResult>`.

If a request class (and its accompanying method on `ITelegramBotClient`) accepts a collection, the type must be `IEnumerable<T>`. Also, return types of JSON array responses will be `TResult[]`.

For example, here is a request with required `allowedUpdates` and optional `offset` parameters that returns a JSON array as result:

```c#
Task<Update[]> GetUpdatesAsync(
IEnumerable<string> allowedUpdates,
int offset = default
);
```

```c#
class GetUpdatesRequest : RequestBase<Update[]> {
IEnumerable<string> AllowedUpdates { get; }
int Offset { get; set; }

public GetUpdatesRequest(IEnumerable<string> allowedUpdates)
: base("getUpdates")
{ AllowedUpdates = allowedUpdates; }
}
```

## Related Documents

- [Change Logs](./CHANGELOG.md)
- [Systems Integration Tests - How To](https://telegrambots.github.io/book/3/tests.html)
- [Systems Integration Tests - How To](https://github.com/TelegramBots/Telegram.Bot/blob/master/test/Telegram.Bot.Tests.Integ/README.md)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# .NET Client for Telegram Bot API
# .NET Client for Telegram Bot API

[![Nuget](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fnuget.voids.site%2Fv3%2Fpackage%2FTelegram.Bot%2Findex.json&query=versions%5B-1%3A%5D&style=flat-square&label=Telegram.Bot&color=d8b541)](https://nuget.voids.site/packages/Telegram.Bot)
[![Bot API Version](https://img.shields.io/badge/Bot%20API-7.7-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api#july-7-2024)
Expand Down Expand Up @@ -51,7 +51,6 @@ use it in your own bot projects.

## 🗂 References

- [Changelog](CHANGELOG.md)
- [Documentation](https://telegrambots.github.io/book/)
- [Examples](https://github.com/TelegramBots/Telegram.Bot.Examples)

Expand Down

0 comments on commit dd9b6a8

Please sign in to comment.