Merge remote-tracking branch 'github/master'
This commit is contained in:
commit
9b8c41dab1
@ -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.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
2. Using Gradle:
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots:6.5.0'
|
||||
implementation 'org.telegram:telegrambots:6.8.0'
|
||||
```
|
||||
|
||||
3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.5.0)
|
||||
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.5.0)
|
||||
3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.8.0)
|
||||
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.8.0)
|
||||
|
||||
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
### <a id="6.4.0"></a>6.4.0 ###
|
||||
### <a id="6.8.0"></a>6.8.0 ###
|
||||
1. Update Api version [6.8](https://core.telegram.org/bots/api-changelog#august-18-2023)
|
||||
2. Fix #1254
|
||||
|
||||
### <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)
|
||||
|
||||
### <a id="6.5.0"></a>6.5.0 ###
|
||||
1. Update Api version [6.5](https://core.telegram.org/bots/api-changelog#february-3-2023)
|
||||
|
||||
### <a id="6.4.0"></a>6.4.0 ###
|
||||
|
@ -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.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
```
|
||||
* With **Gradle**:
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots:6.5.0'
|
||||
implementation 'org.telegram:telegrambots:6.8.0'
|
||||
```
|
||||
|
||||
2. Don't like the **Maven Central Repository**? It can also be grabbed from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
|
||||
|
@ -1,3 +1,10 @@
|
||||
### <a id="6.8.0"></a>To version 6.8.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.
|
||||
|
@ -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.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
```
|
||||
* **Gradle**
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots-abilities:6.5.0'
|
||||
implementation 'org.telegram:telegrambots-abilities:6.8.0'
|
||||
```
|
||||
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)
|
||||
|
||||
|
10
pom.xml
10
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>bots</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
|
||||
<modules>
|
||||
<module>telegrambots</module>
|
||||
@ -72,12 +72,12 @@
|
||||
<junit.version>5.9.1</junit.version>
|
||||
<mockito.version>4.8.1</mockito.version>
|
||||
<mockitojupiter.version>4.8.1</mockitojupiter.version>
|
||||
<jacksonanotation.version>2.14.0</jacksonanotation.version>
|
||||
<jackson.version>2.14.0</jackson.version>
|
||||
<jacksonanotation.version>2.14.2</jacksonanotation.version>
|
||||
<jackson.version>2.14.2</jackson.version>
|
||||
<slf4j.version>2.0.3</slf4j.version>
|
||||
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
|
||||
<lombok.version>1.18.24</lombok.version>
|
||||
<guava.version>31.1-jre</guava.version>
|
||||
<lombok.version>1.18.28</lombok.version>
|
||||
<guava.version>32.0.0-jre</guava.version>
|
||||
<commons.version>3.12.0</commons.version>
|
||||
</properties>
|
||||
|
||||
|
@ -18,14 +18,14 @@ Usage
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-abilities</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Gradle**
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots-abilities:6.5.0'
|
||||
implementation 'org.telegram:telegrambots-abilities:6.8.0'
|
||||
```
|
||||
|
||||
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1)
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>bots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-abilities</artifactId>
|
||||
@ -86,7 +86,7 @@
|
||||
<dependency>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
@ -107,7 +107,7 @@ import static org.telegram.abilitybots.api.util.AbilityUtils.isUserMessage;
|
||||
*
|
||||
* @author Abbas Abou Daya
|
||||
*/
|
||||
@SuppressWarnings({"ConfusingArgumentToVarargsMethod", "UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"})
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"})
|
||||
public abstract class BaseAbilityBot extends DefaultAbsSender implements AbilityExtension {
|
||||
private static final Logger log = LoggerFactory.getLogger(BaseAbilityBot.class);
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
|
@ -30,9 +30,9 @@ public interface MessageSender {
|
||||
|
||||
Boolean addStickerToSet(AddStickerToSet addStickerToSet) throws TelegramApiException;
|
||||
|
||||
public Boolean createNewStickerSet(CreateNewStickerSet createNewStickerSet) throws TelegramApiException;
|
||||
Boolean createNewStickerSet(CreateNewStickerSet createNewStickerSet) throws TelegramApiException;
|
||||
|
||||
public File uploadStickerFile(UploadStickerFile uploadStickerFile) throws TelegramApiException;
|
||||
File uploadStickerFile(UploadStickerFile uploadStickerFile) throws TelegramApiException;
|
||||
|
||||
Boolean setChatPhoto(SetChatPhoto setChatPhoto) throws TelegramApiException;
|
||||
|
||||
|
@ -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) {
|
||||
@ -72,6 +75,4 @@ class SilentSenderTest {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
}
|
@ -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");
|
||||
|
@ -15,14 +15,14 @@ Usage
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-chat-session-bot</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Gradle**
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambots-chat-session-bot:6.5.0'
|
||||
implementation 'org.telegram:telegrambots-chat-session-bot:6.8.0'
|
||||
```
|
||||
|
||||
Motivation
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>bots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-chat-session-bot</artifactId>
|
||||
@ -86,7 +86,7 @@
|
||||
<dependency>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->
|
||||
|
@ -20,7 +20,7 @@ public class DefaultChatIdConverter implements ChatIdConverter {
|
||||
@Override
|
||||
public void setSessionId(Serializable sessionId){
|
||||
this.sessionId = (long) sessionId;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getSessionId() {
|
||||
|
@ -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.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
2. Using Gradle:
|
||||
|
||||
```gradle
|
||||
implementation 'org.telegram:telegrambotsextensions:6.5.0'
|
||||
implementation 'org.telegram:telegrambotsextensions:6.8.0'
|
||||
```
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>bots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambotsextensions</artifactId>
|
||||
@ -77,7 +77,7 @@
|
||||
<dependency>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -26,7 +26,9 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
|
||||
* Creates a TelegramLongPollingCommandBot using default options
|
||||
* Use ICommandRegistry's methods on this bot to register commands
|
||||
*
|
||||
* @deprecated Use {{@link #TelegramLongPollingBot(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public TelegramLongPollingCommandBot() {
|
||||
this(new DefaultBotOptions());
|
||||
}
|
||||
@ -37,7 +39,10 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
|
||||
* Use ICommandRegistry's methods on this bot to register commands
|
||||
*
|
||||
* @param options Bot options
|
||||
*
|
||||
* @deprecated Use {{@link #TelegramLongPollingBot(DefaultBotOptions, String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public TelegramLongPollingCommandBot(DefaultBotOptions options) {
|
||||
this(options, true);
|
||||
}
|
||||
@ -49,12 +54,48 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
|
||||
* @param options Bot options
|
||||
* @param allowCommandsWithUsername true to allow commands with parameters (default),
|
||||
* false otherwise
|
||||
*
|
||||
* @deprecated Use {{@link #TelegramLongPollingBot(DefaultBotOptions, boolean, String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername) {
|
||||
super(options);
|
||||
this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this::getBotUsername);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TelegramLongPollingCommandBot using default options
|
||||
* Use ICommandRegistry's methods on this bot to register commands
|
||||
*
|
||||
*/
|
||||
public TelegramLongPollingCommandBot(String botToken) {
|
||||
this(new DefaultBotOptions(), botToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TelegramLongPollingCommandBot with custom options and allowing commands with
|
||||
* usernames
|
||||
* Use ICommandRegistry's methods on this bot to register commands
|
||||
*
|
||||
* @param options Bot options
|
||||
*/
|
||||
public TelegramLongPollingCommandBot(DefaultBotOptions options, String botToken) {
|
||||
this(options, true, botToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TelegramLongPollingCommandBot
|
||||
* Use ICommandRegistry's methods on this bot to register commands
|
||||
*
|
||||
* @param options Bot options
|
||||
* @param allowCommandsWithUsername true to allow commands with parameters (default),
|
||||
* false otherwise
|
||||
*/
|
||||
public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername, String botToken) {
|
||||
super(options, botToken);
|
||||
this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this::getBotUsername);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onUpdateReceived(Update update) {
|
||||
if (update.hasMessage()) {
|
||||
|
@ -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]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.warp</groupId>
|
||||
<artifactId>bots</artifactId>
|
||||
<version>6.5.0</version>
|
||||
<version>6.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>telegrambots-meta</artifactId>
|
||||
@ -97,6 +97,13 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBool
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -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 don‘t support pagination. Offset length can’t 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
|
||||
|
@ -28,7 +28,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -35,7 +35,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CopyMessage extends BotApiMethod<MessageId> {
|
||||
|
@ -26,7 +26,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -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> {
|
||||
|
@ -22,7 +22,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -27,7 +27,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SetPassportDataErrors extends BotApiMethodBoolean {
|
||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SetMyCommands extends BotApiMethodBoolean {
|
||||
|
@ -0,0 +1,50 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.description;
|
||||
|
||||
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.description.BotDescription;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.6
|
||||
* Use this method to get the current bot description for the given user language.
|
||||
* Returns BotDescription on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class GetMyDescription extends BotApiMethod<BotDescription> {
|
||||
public static final String PATH = "getMyDescription";
|
||||
|
||||
private static final String LANGUAGE_CODE_FIELD = "language_code";
|
||||
|
||||
/**
|
||||
* Optional
|
||||
* A two-letter ISO 639-1 language code.
|
||||
* If empty, the description will be applied to all users for whose language there is no dedicated description.
|
||||
*/
|
||||
@JsonProperty(LANGUAGE_CODE_FIELD)
|
||||
private String languageCode;
|
||||
|
||||
@Override
|
||||
public BotDescription deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
return deserializeResponse(answer, BotDescription.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.description;
|
||||
|
||||
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.description.BotShortDescription;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.6
|
||||
*
|
||||
* Use this method to get the current bot short description for the given user language.
|
||||
*
|
||||
* Returns BotShortDescription on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class GetMyShortDescription extends BotApiMethod<BotShortDescription> {
|
||||
public static final String PATH = "getMyShortDescription";
|
||||
|
||||
private static final String LANGUAGE_CODE_FIELD = "language_code";
|
||||
|
||||
/**
|
||||
* Optional
|
||||
* A two-letter ISO 639-1 language code.
|
||||
* If empty, the description will be applied to all users for whose language there is no dedicated description.
|
||||
*/
|
||||
@JsonProperty(LANGUAGE_CODE_FIELD)
|
||||
private String languageCode;
|
||||
|
||||
@Override
|
||||
public BotShortDescription deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
return deserializeResponse(answer, BotShortDescription.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.description;
|
||||
|
||||
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.6
|
||||
* Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
|
||||
* Returns True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SetMyDescription extends BotApiMethodBoolean {
|
||||
public static final String PATH = "setMyDescription";
|
||||
|
||||
private static final String DESCRIPTION_FIELD = "description";
|
||||
private static final String LANGUAGE_CODE_FIELD = "language_code";
|
||||
|
||||
/**
|
||||
* Optional
|
||||
* New bot description; 0-512 characters.
|
||||
* Pass an empty string to remove the dedicated description for the given language.
|
||||
*/
|
||||
@JsonProperty(DESCRIPTION_FIELD)
|
||||
private String description;
|
||||
/**
|
||||
* Optional
|
||||
* A two-letter ISO 639-1 language code.
|
||||
* If empty, the description will be applied to all users for whose language there is no dedicated description.
|
||||
*/
|
||||
@JsonProperty(LANGUAGE_CODE_FIELD)
|
||||
private String languageCode;
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.description;
|
||||
|
||||
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.6
|
||||
*
|
||||
* Use this method to change the bot's short description, which is shown on the bot's
|
||||
* profile page and is sent together with the link when users share the bot.
|
||||
*
|
||||
* Returns True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SetMyShortDescription extends BotApiMethodBoolean {
|
||||
public static final String PATH = "setMyShortDescription";
|
||||
|
||||
private static final String SHORT_DESCRIPTION_FIELD = "short_description";
|
||||
private static final String LANGUAGE_CODE_FIELD = "language_code";
|
||||
|
||||
/**
|
||||
* Optional
|
||||
* New short description for the bot; 0-120 characters.
|
||||
* Pass an empty string to remove the dedicated short description for the given language.
|
||||
*/
|
||||
@JsonProperty(SHORT_DESCRIPTION_FIELD)
|
||||
private String shortDescription;
|
||||
/**
|
||||
* Optional
|
||||
* A two-letter ISO 639-1 language code.
|
||||
* If empty, the short description will be applied to all users for whose language there is no dedicated short description.
|
||||
*/
|
||||
@JsonProperty(LANGUAGE_CODE_FIELD)
|
||||
private String languageCode;
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
}
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -0,0 +1,70 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.forum;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Tolerate;
|
||||
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 6.8
|
||||
* Use this method to clear the list of pinned messages in a General forum topic.
|
||||
* The bot must be an administrator in the chat for this to work and must have the
|
||||
* can_pin_messages administrator right in the supergroup.
|
||||
*
|
||||
* Returns True on success.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class UnpinAllGeneralForumTopicMessages extends BotApiMethodBoolean {
|
||||
public static final String PATH = "unpinAllGeneralForumTopicMessages";
|
||||
|
||||
private static final String CHAT_ID_FIELD = "chat_id";
|
||||
|
||||
/**
|
||||
* Unique identifier for the target chat or username
|
||||
* of the target supergroup (in the format @supergroupusername)
|
||||
*/
|
||||
@JsonProperty(CHAT_ID_FIELD)
|
||||
@NonNull
|
||||
private String chatId;
|
||||
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() throws TelegramApiValidationException {
|
||||
if (chatId.isEmpty()) {
|
||||
throw new TelegramApiValidationException("ChatId can't be empty", this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
public static class UnpinAllGeneralForumTopicMessagesBuilder {
|
||||
|
||||
@Tolerate
|
||||
public UnpinAllGeneralForumTopicMessagesBuilder chatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ import java.util.ArrayList;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -48,7 +48,7 @@ import java.io.Serializable;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -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 {
|
||||
|
@ -34,7 +34,7 @@ import java.time.ZonedDateTime;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -32,7 +32,7 @@ import java.time.ZonedDateTime;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -30,7 +30,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@Builder
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -31,7 +31,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@Builder
|
||||
|
@ -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> {
|
||||
|
@ -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> {
|
||||
|
@ -30,7 +30,7 @@ import java.util.ArrayList;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class GetChatAdministrators extends BotApiMethod<ArrayList<ChatMember>> {
|
||||
|
@ -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> {
|
||||
|
@ -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> {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -33,7 +33,7 @@ import java.time.ZonedDateTime;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -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> {
|
||||
|
@ -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 {
|
||||
|
@ -25,7 +25,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
@ -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 {
|
||||
|
@ -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> {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CreateInvoiceLink extends BotApiMethod<String> {
|
||||
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendInvoice extends BotApiMethodMessage {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -33,7 +33,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendPoll extends BotApiMethodMessage {
|
||||
|
@ -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> {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.send;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -33,7 +34,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendAnimation extends SendMediaBotMethod<Message> {
|
||||
@ -50,7 +51,7 @@ public class SendAnimation extends SendMediaBotMethod<Message> {
|
||||
public static final String DISABLENOTIFICATION_FIELD = "disable_notification";
|
||||
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
public static final String REPLYMARKUP_FIELD = "reply_markup";
|
||||
public static final String THUMB_FIELD = "thumb";
|
||||
public static final String THUMBNAIL_FIELD = "thumbnail";
|
||||
public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
@ -87,7 +88,7 @@ public class SendAnimation extends SendMediaBotMethod<Message> {
|
||||
* Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>”
|
||||
* if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
*/
|
||||
private InputFile thumb;
|
||||
private InputFile thumbnail;
|
||||
@Singular
|
||||
private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
|
||||
@ -131,8 +132,8 @@ public class SendAnimation extends SendMediaBotMethod<Message> {
|
||||
if (replyMarkup != null) {
|
||||
replyMarkup.validate();
|
||||
}
|
||||
if (thumb != null) {
|
||||
thumb.validate();
|
||||
if (thumbnail != null) {
|
||||
thumbnail.validate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +152,24 @@ public class SendAnimation extends SendMediaBotMethod<Message> {
|
||||
return ANIMATION_FIELD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #getThumbnail()}}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
public InputFile getThumb() {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #setThumbnail(InputFile)}}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
public void setThumb(InputFile thumb) {
|
||||
this.thumbnail = thumb;
|
||||
}
|
||||
|
||||
public static class SendAnimationBuilder {
|
||||
|
||||
@Tolerate
|
||||
@ -158,5 +177,12 @@ public class SendAnimation extends SendMediaBotMethod<Message> {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Tolerate
|
||||
@Deprecated
|
||||
public SendAnimationBuilder thumb(InputFile thumb) {
|
||||
this.thumbnail = thumb;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.send;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -34,7 +35,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendAudio extends SendMediaBotMethod<Message> {
|
||||
@ -51,7 +52,7 @@ public class SendAudio extends SendMediaBotMethod<Message> {
|
||||
public static final String TITLE_FIELD = "title";
|
||||
public static final String CAPTION_FIELD = "caption";
|
||||
public static final String PARSEMODE_FIELD = "parse_mode";
|
||||
public static final String THUMB_FIELD = "thumb";
|
||||
public static final String THUMBNAIL_FIELD = "thumbnail";
|
||||
public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
@ -111,7 +112,7 @@ public class SendAudio extends SendMediaBotMethod<Message> {
|
||||
* Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass
|
||||
* “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
*/
|
||||
private InputFile thumb;
|
||||
private InputFile thumbnail;
|
||||
/**
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*/
|
||||
@ -156,8 +157,8 @@ public class SendAudio extends SendMediaBotMethod<Message> {
|
||||
|
||||
audio.validate();
|
||||
|
||||
if (thumb != null) {
|
||||
thumb.validate();
|
||||
if (thumbnail != null) {
|
||||
thumbnail.validate();
|
||||
}
|
||||
|
||||
if (replyMarkup != null) {
|
||||
@ -180,6 +181,24 @@ public class SendAudio extends SendMediaBotMethod<Message> {
|
||||
return AUDIO_FIELD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #getThumbnail()}}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
public InputFile getThumb() {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #setThumbnail(InputFile)}}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
public void setThumb(InputFile thumb) {
|
||||
this.thumbnail = thumb;
|
||||
}
|
||||
|
||||
public static class SendAudioBuilder {
|
||||
|
||||
@Tolerate
|
||||
@ -187,5 +206,12 @@ public class SendAudio extends SendMediaBotMethod<Message> {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Tolerate
|
||||
@Deprecated
|
||||
public SendAudioBuilder thumb(InputFile thumb) {
|
||||
this.thumbnail = thumb;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -29,7 +29,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendDice extends BotApiMethodMessage {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.send;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -30,7 +31,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendDocument extends SendMediaBotMethod<Message> {
|
||||
@ -44,7 +45,7 @@ public class SendDocument extends SendMediaBotMethod<Message> {
|
||||
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
|
||||
public static final String REPLYMARKUP_FIELD = "reply_markup";
|
||||
public static final String PARSEMODE_FIELD = "parse_mode";
|
||||
public static final String THUMB_FIELD = "thumb";
|
||||
public static final String THUMBNAIL_FIELD = "thumbnail";
|
||||
public static final String CAPTION_ENTITIES_FIELD = "caption_entities";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String DISABLECONTENTTYPEDETECTION_FIELD = "disable_content_type_detection";
|
||||
@ -93,7 +94,7 @@ public class SendDocument extends SendMediaBotMethod<Message> {
|
||||
* Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>”
|
||||
* if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
|
||||
*/
|
||||
private InputFile thumb;
|
||||
private InputFile thumbnail;
|
||||
/**
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*/
|
||||
@ -142,8 +143,8 @@ public class SendDocument extends SendMediaBotMethod<Message> {
|
||||
|
||||
document.validate();
|
||||
|
||||
if (thumb != null) {
|
||||
thumb.validate();
|
||||
if (thumbnail != null) {
|
||||
thumbnail.validate();
|
||||
}
|
||||
|
||||
if (replyMarkup != null) {
|
||||
@ -166,6 +167,24 @@ public class SendDocument extends SendMediaBotMethod<Message> {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #getThumbnail()}}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
public InputFile getThumb() {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #setThumbnail(InputFile)}}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
public void setThumb(InputFile thumb) {
|
||||
this.thumbnail = thumb;
|
||||
}
|
||||
|
||||
public static class SendDocumentBuilder {
|
||||
|
||||
@Tolerate
|
||||
@ -173,5 +192,12 @@ public class SendDocument extends SendMediaBotMethod<Message> {
|
||||
this.chatId = chatId.toString();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Tolerate
|
||||
@Deprecated
|
||||
public SendDocumentBuilder thumb(InputFile thumb) {
|
||||
this.thumbnail = thumb;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -32,7 +32,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Deprecated
|
||||
|
@ -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 {
|
||||
|
@ -36,7 +36,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendMediaGroup extends PartialBotApiMethod<ArrayList<Message>> {
|
||||
|
@ -31,7 +31,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendMessage extends BotApiMethodMessage {
|
||||
|
@ -31,7 +31,7 @@ import java.util.Objects;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendPhoto extends SendMediaBotMethod<Message> {
|
||||
|
@ -27,7 +27,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendSticker extends SendMediaBotMethod<Message> {
|
||||
@ -41,6 +41,7 @@ public class SendSticker extends SendMediaBotMethod<Message> {
|
||||
public static final String REPLYMARKUP_FIELD = "reply_markup";
|
||||
public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
|
||||
public static final String PROTECTCONTENT_FIELD = "protect_content";
|
||||
public static final String EMOJI_FIELD = "emoji";
|
||||
|
||||
@NonNull
|
||||
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
|
||||
@ -49,6 +50,14 @@ public class SendSticker extends SendMediaBotMethod<Message> {
|
||||
* for forum supergroups only
|
||||
*/
|
||||
private Integer messageThreadId;
|
||||
/**
|
||||
* Sticker to send.
|
||||
* Pass a file_id as String to send a file that exists on the Telegram servers (recommended),
|
||||
* pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet,
|
||||
* or upload a new .WEBP or .TGS sticker using multipart/form-data.
|
||||
* Video stickers can only be sent by a file_id.
|
||||
* Animated stickers can't be sent via an HTTP URL.
|
||||
*/
|
||||
@NonNull
|
||||
private InputFile sticker; ///< Sticker file to send. file_id as String to resend a sticker that is already on the Telegram servers or URL to upload it
|
||||
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
|
||||
@ -57,6 +66,12 @@ public class SendSticker extends SendMediaBotMethod<Message> {
|
||||
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
|
||||
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
|
||||
|
||||
/**
|
||||
* Optional
|
||||
* Emoji associated with the sticker; only for uploaded stickers
|
||||
*/
|
||||
private String emoji;
|
||||
|
||||
@Tolerate
|
||||
public void setChatId(@NonNull Long chatId) {
|
||||
this.chatId = chatId.toString();
|
||||
|
@ -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 {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user