Merge pull request #1233 from rubenlagus/dev

Dev
This commit is contained in:
Ruben Bermudez 2023-06-11 13:33:53 +01:00 committed by GitHub
commit 7029a35cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
164 changed files with 590 additions and 208 deletions

View File

@ -27,18 +27,18 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
```
2. Using Gradle:
```gradle
implementation 'org.telegram:telegrambots:6.6.0'
implementation 'org.telegram:telegrambots:6.7.0'
```
3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.6.0)
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.6.0)
3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.7.0)
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.7.0)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

View File

@ -1,3 +1,8 @@
### <a id="6.7.0"></a>6.7.0 ###
1. Update Api version [6.7](https://core.telegram.org/bots/api-changelog#april-21-2023)
**[[How to update to version 6.7.0|How-To-Update#6.7.0]]**
### <a id="6.6.0"></a>6.6.0 ###
1. Update Api version [6.6](https://core.telegram.org/bots/api-changelog#march-9-2023)

View File

@ -11,13 +11,13 @@ First you need to acquire the library and add it to your project. There are seve
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
```
* With **Gradle**:
```gradle
implementation 'org.telegram:telegrambots:6.6.0'
implementation 'org.telegram:telegrambots:6.7.0'
```
2. Don't like the **Maven Central Repository**? It can also be grabbed from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).

View File

@ -1,3 +1,10 @@
### <a id="6.7.0"></a>To version 6.7.0 ###
1. Api methods with thumbnails have changed the field, use getThumbnail()/setThumbnail() instead of getThumb()/setThumb()
2. In `AddStickerToSet`/`CreateNewStickerSet`/`UploadStickerFile`/etc, use field `sticker` instead of the deprecated fields.
3. `ChatMember` has more details permissions, use those instead of the legacy general ones.
4. All classes with mandatory fields will lose the default no-arg constructor in the future.
5. In `AnswerInlineQuery`, start using the `button` field instead of deprecated parameters.
### <a id="6.1.0"></a>To version 6.1.0 ###
1. As per API guidelines, FileSize can now have 64 bits size, hence they are now using Long datatype instead of Integer.
2. Methods accept chatId as Long or String.

View File

@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
```
* **Gradle**
```gradle
implementation 'org.telegram:telegrambots-abilities:6.6.0'
implementation 'org.telegram:telegrambots-abilities:6.7.0'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)

View File

@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>6.6.0</version>
<version>6.7.0</version>
<modules>
<module>telegrambots</module>

View File

@ -18,14 +18,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
```
**Gradle**
```gradle
implementation 'org.telegram:telegrambots-abilities:6.6.0'
implementation 'org.telegram:telegrambots-abilities:6.7.0'
```
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1)

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</parent>
<artifactId>telegrambots-abilities</artifactId>
@ -84,7 +84,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>

View File

@ -3,7 +3,7 @@ package org.telegram.abilitybots.api.objects;
import org.telegram.abilitybots.api.objects.Ability.AbilityBuilder;
import org.telegram.telegrambots.meta.api.objects.Update;
import java.util.function.Consumer;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
import static java.util.Objects.nonNull;
@ -11,7 +11,7 @@ import static java.util.Objects.nonNull;
/**
* Flags are an conditions that are applied on an {@link Update}.
* <p>
* They can be used on {@link AbilityBuilder#flag(Predicate[])} and on the post conditions in {@link AbilityBuilder#reply(Consumer, Predicate[])}.
* They can be used on {@link AbilityBuilder#flag(Predicate[])} and on the post conditions in {@link AbilityBuilder#reply(BiConsumer, Predicate[])}.
*
* @author Abbas Abou Daya
*/

View File

@ -9,7 +9,6 @@ import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
@ -18,7 +17,7 @@ import static com.google.common.collect.Lists.newArrayList;
/**
* A reply consists of update conditionals and an action to be applied on the update.
* <p>
* If an update satisfies the {@link Reply#conditions} set by the reply, then it's safe to {@link Reply#actOn(Update)}.
* If an update satisfies the {@link Reply#conditions} set by the reply, then it's safe to {@link Reply#actOn(BaseAbilityBot, Update)}.
*
* @author Abbas Abou Daya
*/

View File

@ -12,7 +12,6 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

View File

@ -14,7 +14,10 @@ import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
class SilentSenderTest {
private SilentSender silent;
@ -55,7 +58,7 @@ class SilentSenderTest {
verify(sender, only()).executeAsync(methodObject, callback);
}
private class NoOpCallback implements SentCallback<Message> {
private static class NoOpCallback implements SentCallback<Message> {
@Override
public void onResult(BotApiMethod<Message> method, Message response) {

View File

@ -7,12 +7,14 @@ import org.telegram.abilitybots.api.bot.DefaultAbilities;
import org.telegram.abilitybots.api.bot.DefaultBot;
import org.telegram.abilitybots.api.db.DBContext;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;
import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.telegram.abilitybots.api.db.MapDBContext.offlineInstance;
class CustomToggleTest {
@ -55,7 +57,7 @@ class CustomToggleTest {
public void canTurnOffAbilitiesThroughProperties() {
Properties properties = new Properties();
try {
properties.load(new FileInputStream(filename));
properties.load(Files.newInputStream(Paths.get(filename)));
toggle = new CustomToggle().config(properties);
} catch (IOException e) {
System.out.println("No such file");
@ -71,7 +73,7 @@ class CustomToggleTest {
public void canProcessAbilitiesThroughProperties() {
Properties properties = new Properties();
try {
properties.load(new FileInputStream(filename));
properties.load(Files.newInputStream(Paths.get(filename)));
toggle = new CustomToggle().config(properties);
} catch (IOException e) {
System.out.println("No such file");

View File

@ -15,14 +15,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
```
**Gradle**
```gradle
implementation 'org.telegram:telegrambots-chat-session-bot:6.6.0'
implementation 'org.telegram:telegrambots-chat-session-bot:6.7.0'
```
Motivation

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</parent>
<artifactId>telegrambots-chat-session-bot</artifactId>
@ -84,7 +84,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->

View File

@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
```
2. Using Gradle:
```gradle
implementation 'org.telegram:telegrambotsextensions:6.6.0'
implementation 'org.telegram:telegrambotsextensions:6.7.0'
```

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</parent>
<artifactId>telegrambotsextensions</artifactId>
@ -75,7 +75,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</dependency>
</dependencies>

View File

@ -42,7 +42,7 @@ public class HelpCommand extends ManCommand {
* @return a formatted String containing command and description for all supplied commands
*/
public static String getHelpText(Collection<IBotCommand> botCommands) {
return getHelpText(botCommands.toArray(new IBotCommand[botCommands.size()]));
return getHelpText(botCommands.toArray(new IBotCommand[0]));
}
/**

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
</parent>
<artifactId>telegrambots-meta</artifactId>

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBool
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -11,8 +11,10 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
import lombok.extern.jackson.Jacksonized;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResultsButton;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.List;
@ -27,9 +29,10 @@ import java.util.regex.Pattern;
@Getter
@Setter
@ToString
@NoArgsConstructor
@RequiredArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Jacksonized
@Builder
public class AnswerInlineQuery extends BotApiMethodBoolean {
public static final String PATH = "answerInlineQuery";
@ -41,6 +44,7 @@ public class AnswerInlineQuery extends BotApiMethodBoolean {
private static final String NEXTOFFSET_FIELD = "next_offset";
private static final String SWITCH_PM_TEXT_FIELD = "switch_pm_text";
private static final String SWITCH_PM_PARAMETER_FIELD = "switch_pm_parameter";
private static final String BUTTON_FIELD = "button";
@JsonProperty(INLINEQUERYID_FIELD)
@NonNull
@ -55,19 +59,39 @@ public class AnswerInlineQuery extends BotApiMethodBoolean {
private Boolean isPersonal; ///< Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
@JsonProperty(NEXTOFFSET_FIELD)
private String nextOffset; ///< Optional. Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you dont support pagination. Offset length cant exceed 64 bytes.
/**
* Optional.
* If passed, clients will display a button with specified text that switches the user to a private chat with the
* bot and sends the bot a start message with the parameter switch_pm_parameter
*
* @deprecated Use {@link #setButton(InlineQueryResultsButton)}
*/
@JsonProperty(SWITCH_PM_TEXT_FIELD)
private String switchPmText; ///< Optional. If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter
@Deprecated
private String switchPmText;
/**
* Optional.
* Parameter for the start message sent to the bot when user presses the switch button
*
* @deprecated Use {@link #setButton(InlineQueryResultsButton)}
*/
@JsonProperty(SWITCH_PM_PARAMETER_FIELD)
private String switchPmParameter; ///< Optional. Parameter for the start message sent to the bot when user presses the switch button
@Deprecated
private String switchPmParameter;
/**
* Optional.
* A JSON serialized object describing a button to be shown above inline query results
*/
@JsonProperty(BUTTON_FIELD)
private InlineQueryResultsButton button;
@Override
public void validate() throws TelegramApiValidationException {
if (inlineQueryId == null || inlineQueryId.isEmpty()) {
if (inlineQueryId.isEmpty()) {
throw new TelegramApiValidationException("InlineQueryId can't be empty", this);
}
if (results == null) {
throw new TelegramApiValidationException("Results array can't be null", this);
}
if (switchPmText != null) {
if (switchPmText.isEmpty()) {
throw new TelegramApiValidationException("SwitchPmText can't be empty", this);
@ -85,6 +109,10 @@ public class AnswerInlineQuery extends BotApiMethodBoolean {
for (InlineQueryResult result : results) {
result.validate();
}
if (button != null) {
button.validate();
}
}
@Override

View File

@ -28,7 +28,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -30,7 +30,7 @@ import java.util.List;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -35,7 +35,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class CopyMessage extends BotApiMethod<MessageId> {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GetFile extends BotApiMethod<File> {

View File

@ -22,7 +22,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -27,7 +27,7 @@ import java.util.List;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetPassportDataErrors extends BotApiMethodBoolean {

View File

@ -28,7 +28,7 @@ import java.util.List;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetMyCommands extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class CloseForumTopic extends BotApiMethodBoolean {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class CloseGeneralForumTopic extends BotApiMethodBoolean {

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class DeleteForumTopic extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class EditForumTopic extends BotApiMethodBoolean {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class EditGeneralForumTopic extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class HideGeneralForumTopic extends BotApiMethodBoolean {

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class ReopenForumTopic extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class ReopenGeneralForumTopic extends BotApiMethodBoolean {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class UnhideGeneralForumTopic extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class UnpinAllForumTopicMessages extends BotApiMethodBoolean {

View File

@ -51,7 +51,7 @@ import java.util.ArrayList;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -48,7 +48,7 @@ import java.io.Serializable;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -24,7 +24,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@Builder
public class ApproveChatJoinRequest extends BotApiMethodBoolean {

View File

@ -34,7 +34,7 @@ import java.time.ZonedDateTime;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -32,7 +32,7 @@ import java.time.ZonedDateTime;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -30,7 +30,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@RequiredArgsConstructor
@Builder

View File

@ -24,7 +24,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@Builder
public class DeclineChatJoinRequest extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class DeleteChatPhoto extends BotApiMethodBoolean {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class DeleteChatStickerSet extends BotApiMethodBoolean {

View File

@ -31,7 +31,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@RequiredArgsConstructor
@Builder

View File

@ -32,7 +32,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class ExportChatInviteLink extends BotApiMethod<String> {

View File

@ -24,7 +24,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GetChat extends BotApiMethod<Chat> {

View File

@ -30,7 +30,7 @@ import java.util.ArrayList;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GetChatAdministrators extends BotApiMethod<ArrayList<ChatMember>> {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GetChatMember extends BotApiMethod<ChatMember> {

View File

@ -23,7 +23,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GetChatMemberCount extends BotApiMethod<Integer> {

View File

@ -22,7 +22,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class LeaveChat extends BotApiMethodBoolean {

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class PromoteChatMember extends BotApiMethodBoolean {

View File

@ -33,7 +33,7 @@ import java.time.ZonedDateTime;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -32,7 +32,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class RevokeChatInviteLink extends BotApiMethod<ChatInviteLink> {

View File

@ -23,7 +23,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetChatAdministratorCustomTitle extends BotApiMethodBoolean {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@RequiredArgsConstructor
@AllArgsConstructor
@Builder

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetChatPermissions extends BotApiMethodBoolean {

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetChatPhoto extends PartialBotApiMethod<Boolean> {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetChatStickerSet extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetChatTitle extends BotApiMethodBoolean {

View File

@ -31,7 +31,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class UnbanChatMember extends BotApiMethodBoolean {

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class UnbanChatSenderChat extends BotApiMethodBoolean {

View File

@ -30,7 +30,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class CreateInvoiceLink extends BotApiMethod<String> {

View File

@ -30,7 +30,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendInvoice extends BotApiMethodMessage {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetChatMenuButton extends BotApiMethodBoolean {

View File

@ -0,0 +1,50 @@
package org.telegram.telegrambots.meta.api.methods.name;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.name.BotName;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
/**
* @author Ruben Bermudez
* @version 6.7
* Use this method to get the current bot name for the given user language.
*
* Returns BotName on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetMyName extends BotApiMethod<BotName> {
public static final String PATH = "getMyDescription";
private static final String LANGUAGE_CODE_FIELD = "language_code";
/**
* Optional
* A two-letter ISO 639-1 language code or an empty string
*/
@JsonProperty(LANGUAGE_CODE_FIELD)
private String languageCode;
@Override
public BotName deserializeResponse(String answer) throws TelegramApiRequestException {
return deserializeResponse(answer, BotName.class);
}
@Override
public String getMethod() {
return PATH;
}
}

View File

@ -0,0 +1,51 @@
package org.telegram.telegrambots.meta.api.methods.name;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
/**
* @author Ruben Bermudez
* @version 6.7
* Use this method to change the bot's name. Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SetMyName extends BotApiMethodBoolean {
public static final String PATH = "setMyName";
private static final String NAME_FIELD = "name";
private static final String LANGUAGE_CODE_FIELD = "language_code";
/**
* Optional
* New bot name; 0-64 characters.
* Pass an empty string to remove the dedicated name for the given language.
*/
@JsonProperty(NAME_FIELD)
private String name;
/**
* Optional
* A two-letter ISO 639-1 language code.
* If empty, the name will be shown to all users for whose language there is no dedicated name.
*/
@JsonProperty(LANGUAGE_CODE_FIELD)
private String languageCode;
@Override
public String getMethod() {
return PATH;
}
}

View File

@ -28,7 +28,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class PinChatMessage extends BotApiMethodBoolean {

View File

@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class UnpinAllChatMessages extends BotApiMethodBoolean {

View File

@ -29,7 +29,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class UnpinChatMessage extends BotApiMethodBoolean {

View File

@ -33,7 +33,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendPoll extends BotApiMethodMessage {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class StopPoll extends BotApiMethod<Poll> {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendChatAction extends BotApiMethodBoolean {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendContact extends BotApiMethodMessage {

View File

@ -29,7 +29,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendDice extends BotApiMethodMessage {

View File

@ -42,7 +42,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendGame extends BotApiMethodMessage {

View File

@ -32,7 +32,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
@Deprecated

View File

@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendLocation extends BotApiMethodMessage {

View File

@ -36,7 +36,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendMediaGroup extends PartialBotApiMethod<ArrayList<Message>> {

View File

@ -31,7 +31,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendMessage extends BotApiMethodMessage {

View File

@ -31,7 +31,7 @@ import java.util.Objects;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendPhoto extends SendMediaBotMethod<Message> {

View File

@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendVenue extends BotApiMethodMessage {

View File

@ -32,7 +32,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SendVoice extends SendMediaBotMethod<Message> {

View File

@ -21,7 +21,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class DeleteStickerFromSet extends BotApiMethodBoolean {

View File

@ -1,10 +1,15 @@
package org.telegram.telegrambots.meta.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.api.objects.games.GameHighScore;
import org.telegram.telegrambots.meta.api.objects.stickers.Sticker;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -23,7 +23,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GetStickerSet extends BotApiMethod<StickerSet> {

View File

@ -33,7 +33,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class SetWebhook extends BotApiMethodBoolean {

View File

@ -31,7 +31,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class DeleteMessage extends BotApiMethodBoolean {

View File

@ -29,7 +29,7 @@ import java.io.Serializable;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class EditMessageLiveLocation extends BotApiMethodSerializable {

View File

@ -38,7 +38,7 @@ import java.io.Serializable;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class EditMessageMedia extends PartialBotApiMethod<Serializable> {

View File

@ -33,7 +33,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class EditMessageText extends BotApiMethodSerializable {

View File

@ -29,7 +29,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@Getter
@Setter
@ToString
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class AnswerWebAppQuery extends BotApiMethod<SentWebAppMessage> {

View File

@ -25,7 +25,7 @@ import java.util.List;
@Setter
@ToString
@RequiredArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
@AllArgsConstructor
public class Chat implements BotApiObject {

View File

@ -25,9 +25,10 @@ public class ChatMemberUpdated implements BotApiObject {
private static final String CHAT_FIELD = "chat";
private static final String FROM_FIELD = "from";
private static final String DATE_FIELD = "date";
private static final String OLDCHATMEMBER_FIELD = "old_chat_member";
private static final String NEWCHATMEMBER_FIELD = "new_chat_member";
private static final String INVITELINK_FIELD = "invite_link";
private static final String OLD_CHAT_MEMBER_FIELD = "old_chat_member";
private static final String NEW_CHAT_MEMBER_FIELD = "new_chat_member";
private static final String INVITE_LINK_FIELD = "invite_link";
private static final String VIA_CHAT_FOLDER_INVITE_LINK_FIELD = "via_chat_folder_invite_link";
/**
* Chat the user belongs to
@ -47,18 +48,25 @@ public class ChatMemberUpdated implements BotApiObject {
/**
* Previous information about the chat member
*/
@JsonProperty(OLDCHATMEMBER_FIELD)
@JsonProperty(OLD_CHAT_MEMBER_FIELD)
private ChatMember oldChatMember;
/**
* New information about the chat member
*/
@JsonProperty(NEWCHATMEMBER_FIELD)
@JsonProperty(NEW_CHAT_MEMBER_FIELD)
private ChatMember newChatMember;
/**
* Optional.
* Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
*/
@JsonProperty(INVITELINK_FIELD)
@JsonProperty(INVITE_LINK_FIELD)
private ChatInviteLink inviteLink;
/**
* Optional.
* True, if the user joined the chat via a chat folder invite link
*/
@JsonProperty(VIA_CHAT_FOLDER_INVITE_LINK_FIELD)
private Boolean viaChatFolderInviteLink;
}

View File

@ -20,7 +20,7 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor(force = true)
public class Location implements BotApiObject {
private static final String LONGITUDE_FIELD = "longitude";

Some files were not shown because too many files have changed in this diff Show More