commit
32be70c9eb
63
Bots.ipr
63
Bots.ipr
@ -22,10 +22,10 @@
|
|||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
<module name="telegrambots-meta" />
|
|
||||||
<module name="telegrambots-extensions" />
|
|
||||||
<module name="telegrambots" />
|
|
||||||
<module name="telegrambots-abilities" />
|
<module name="telegrambots-abilities" />
|
||||||
|
<module name="telegrambots-extensions" />
|
||||||
|
<module name="telegrambots-meta" />
|
||||||
|
<module name="telegrambots" />
|
||||||
<module name="telegrambots-chat-session-bot" />
|
<module name="telegrambots-chat-session-bot" />
|
||||||
<module name="telegrambots-spring-boot-starter" />
|
<module name="telegrambots-spring-boot-starter" />
|
||||||
</profile>
|
</profile>
|
||||||
@ -1280,39 +1280,6 @@
|
|||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.10/httpmime-4.5.10-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.10/httpmime-4.5.10-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Maven: org.apache.logging.log4j:log4j-api:2.12.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Maven: org.apache.logging.log4j:log4j-core:2.12.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-core/2.12.1/log4j-core-2.12.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-core/2.12.1/log4j-core-2.12.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-core/2.12.1/log4j-core-2.12.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.12.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-slf4j-impl/2.12.1/log4j-slf4j-impl-2.12.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-slf4j-impl/2.12.1/log4j-slf4j-impl-2.12.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-slf4j-impl/2.12.1/log4j-slf4j-impl-2.12.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Maven: org.apache.shiro:shiro-cache:1.4.2">
|
<library name="Maven: org.apache.shiro:shiro-cache:1.4.2">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/shiro/shiro-cache/1.4.2/shiro-cache-1.4.2.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/apache/shiro/shiro-cache/1.4.2/shiro-cache-1.4.2.jar!/" />
|
||||||
@ -1456,37 +1423,37 @@
|
|||||||
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/mojo/animal-sniffer-annotations/1.18/animal-sniffer-annotations-1.18-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/mojo/animal-sniffer-annotations/1.18/animal-sniffer-annotations-1.18-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Maven: org.eclipse.collections:eclipse-collections-api:10.0.0">
|
<library name="Maven: org.eclipse.collections:eclipse-collections-api:10.1.0">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-api/10.0.0/eclipse-collections-api-10.0.0.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-api/10.1.0/eclipse-collections-api-10.1.0.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC>
|
<JAVADOC>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-api/10.0.0/eclipse-collections-api-10.0.0-javadoc.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-api/10.1.0/eclipse-collections-api-10.1.0-javadoc.jar!/" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-api/10.0.0/eclipse-collections-api-10.0.0-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-api/10.1.0/eclipse-collections-api-10.1.0-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Maven: org.eclipse.collections:eclipse-collections-forkjoin:10.0.0">
|
<library name="Maven: org.eclipse.collections:eclipse-collections-forkjoin:10.1.0">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-forkjoin/10.0.0/eclipse-collections-forkjoin-10.0.0.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-forkjoin/10.1.0/eclipse-collections-forkjoin-10.1.0.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC>
|
<JAVADOC>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-forkjoin/10.0.0/eclipse-collections-forkjoin-10.0.0-javadoc.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-forkjoin/10.1.0/eclipse-collections-forkjoin-10.1.0-javadoc.jar!/" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-forkjoin/10.0.0/eclipse-collections-forkjoin-10.0.0-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections-forkjoin/10.1.0/eclipse-collections-forkjoin-10.1.0-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Maven: org.eclipse.collections:eclipse-collections:10.0.0">
|
<library name="Maven: org.eclipse.collections:eclipse-collections:10.1.0">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections/10.0.0/eclipse-collections-10.0.0.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections/10.1.0/eclipse-collections-10.1.0.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC>
|
<JAVADOC>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections/10.0.0/eclipse-collections-10.0.0-javadoc.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections/10.1.0/eclipse-collections-10.1.0-javadoc.jar!/" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections/10.0.0/eclipse-collections-10.0.0-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/collections/eclipse-collections/10.1.0/eclipse-collections-10.1.0-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Maven: org.glassfish.grizzly:grizzly-framework:2.4.4">
|
<library name="Maven: org.glassfish.grizzly:grizzly-framework:2.4.4">
|
||||||
|
@ -27,16 +27,16 @@ Just import add the library to your project with one of these options:
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
compile "org.telegram:telegrambots:4.4.0.2"
|
compile "org.telegram:telegrambots:4.5"
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.4.0.2)
|
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.5)
|
||||||
3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.4.0.2)
|
3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.5)
|
||||||
|
|
||||||
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
|
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
### <a id="4.5"></a>4.5 ###
|
||||||
|
1. Update Api version [4.5](https://core.telegram.org/bots/api-changelog#december-31-2019)
|
||||||
|
2. Fixes: #697, #710
|
||||||
|
|
||||||
### <a id="4.4.0.2"></a>4.4.0.2 ###
|
### <a id="4.4.0.2"></a>4.4.0.2 ###
|
||||||
1. Use SLF4J
|
1. Use SLF4J
|
||||||
2. Support case-insensitive usernames
|
2. Support case-insensitive usernames
|
||||||
|
@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
* With **Gradle**:
|
* With **Gradle**:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
compile group: 'org.telegram', name: 'telegrambots', version: '4.4.0.2'
|
compile group: 'org.telegram', name: 'telegrambots', version: '4.5'
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
|
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
|
||||||
|
@ -9,7 +9,7 @@ As with any Java project, you will need to set your dependencies.
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots-abilities</artifactId>
|
<artifactId>telegrambots-abilities</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
* **Gradle**
|
* **Gradle**
|
||||||
|
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
|||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>telegrambots</module>
|
<module>telegrambots</module>
|
||||||
|
@ -18,19 +18,19 @@ Usage
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots-abilities</artifactId>
|
<artifactId>telegrambots-abilities</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
**Gradle**
|
**Gradle**
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
compile "org.telegram:telegrambots-abilities:4.4.0.2"
|
compile "org.telegram:telegrambots-abilities:4.5"
|
||||||
```
|
```
|
||||||
|
|
||||||
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.4.0.2)
|
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.5)
|
||||||
|
|
||||||
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.4.0.2)
|
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.5)
|
||||||
|
|
||||||
Motivation
|
Motivation
|
||||||
----------
|
----------
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegrambots-abilities</artifactId>
|
<artifactId>telegrambots-abilities</artifactId>
|
||||||
@ -78,14 +78,13 @@
|
|||||||
|
|
||||||
<commonslang.version>3.9</commonslang.version>
|
<commonslang.version>3.9</commonslang.version>
|
||||||
<mapdb.version>3.0.7</mapdb.version>
|
<mapdb.version>3.0.7</mapdb.version>
|
||||||
<log4j.version>2.12.1</log4j.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@ -103,16 +102,6 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-slf4j-impl</artifactId>
|
|
||||||
<version>${log4j.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-core</artifactId>
|
|
||||||
<version>${log4j.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -3,8 +3,8 @@ package org.telegram.abilitybots.api.bot;
|
|||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.slf4j.Logger;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.telegram.abilitybots.api.db.DBContext;
|
import org.telegram.abilitybots.api.db.DBContext;
|
||||||
import org.telegram.abilitybots.api.objects.Ability;
|
import org.telegram.abilitybots.api.objects.Ability;
|
||||||
import org.telegram.abilitybots.api.objects.MessageContext;
|
import org.telegram.abilitybots.api.objects.MessageContext;
|
||||||
@ -35,12 +35,36 @@ import static java.util.Objects.nonNull;
|
|||||||
import static java.util.stream.Collectors.joining;
|
import static java.util.stream.Collectors.joining;
|
||||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
import static org.telegram.abilitybots.api.objects.Ability.builder;
|
import static org.telegram.abilitybots.api.objects.Ability.builder;
|
||||||
import static org.telegram.abilitybots.api.objects.Flag.*;
|
import static org.telegram.abilitybots.api.objects.Flag.DOCUMENT;
|
||||||
|
import static org.telegram.abilitybots.api.objects.Flag.MESSAGE;
|
||||||
|
import static org.telegram.abilitybots.api.objects.Flag.REPLY;
|
||||||
import static org.telegram.abilitybots.api.objects.Locality.ALL;
|
import static org.telegram.abilitybots.api.objects.Locality.ALL;
|
||||||
import static org.telegram.abilitybots.api.objects.Locality.USER;
|
import static org.telegram.abilitybots.api.objects.Locality.USER;
|
||||||
import static org.telegram.abilitybots.api.objects.Privacy.*;
|
import static org.telegram.abilitybots.api.objects.Privacy.ADMIN;
|
||||||
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.*;
|
import static org.telegram.abilitybots.api.objects.Privacy.CREATOR;
|
||||||
import static org.telegram.abilitybots.api.util.AbilityUtils.*;
|
import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_BAN_FAIL;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_BAN_SUCCESS;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_CLAIM_FAIL;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_CLAIM_SUCCESS;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_COMMANDS_NOT_FOUND;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_DEMOTE_FAIL;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_DEMOTE_SUCCESS;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_PROMOTE_FAIL;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_PROMOTE_SUCCESS;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_RECOVER_ERROR;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_RECOVER_FAIL;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_RECOVER_MESSAGE;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_RECOVER_SUCCESS;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_UNBAN_FAIL;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.ABILITY_UNBAN_SUCCESS;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityMessageCodes.USER_NOT_FOUND;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityUtils.addTag;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityUtils.commitTo;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityUtils.escape;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityUtils.getLocalizedMessage;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityUtils.shortName;
|
||||||
|
import static org.telegram.abilitybots.api.util.AbilityUtils.stripTag;
|
||||||
|
|
||||||
public final class DefaultAbilities implements AbilityExtension {
|
public final class DefaultAbilities implements AbilityExtension {
|
||||||
// Default commands
|
// Default commands
|
||||||
@ -53,7 +77,7 @@ public final class DefaultAbilities implements AbilityExtension {
|
|||||||
public static final String RECOVER = "recover";
|
public static final String RECOVER = "recover";
|
||||||
public static final String COMMANDS = "commands";
|
public static final String COMMANDS = "commands";
|
||||||
public static final String REPORT = "report";
|
public static final String REPORT = "report";
|
||||||
private static final Logger log = LogManager.getLogger(DefaultAbilities.class);
|
private static final Logger log = LoggerFactory.getLogger(DefaultAbilities.class);
|
||||||
private final BaseAbilityBot bot;
|
private final BaseAbilityBot bot;
|
||||||
|
|
||||||
public DefaultAbilities(BaseAbilityBot bot) {
|
public DefaultAbilities(BaseAbilityBot bot) {
|
||||||
|
@ -15,7 +15,7 @@ Usage
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots-chat-session-bot</artifactId>
|
<artifactId>telegrambots-chat-session-bot</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegrambots-chat-session-bot</artifactId>
|
<artifactId>telegrambots-chat-session-bot</artifactId>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->
|
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->
|
||||||
|
@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambotsextensions</artifactId>
|
<artifactId>telegrambotsextensions</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Using Gradle:
|
2. Using Gradle:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
compile "org.telegram:telegrambotsextensions:4.4.0.2"
|
compile "org.telegram:telegrambotsextensions:4.5"
|
||||||
```
|
```
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegrambotsextensions</artifactId>
|
<artifactId>telegrambotsextensions</artifactId>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegrambots-meta</artifactId>
|
<artifactId>telegrambots-meta</artifactId>
|
||||||
|
@ -3,10 +3,10 @@ package org.telegram.telegrambots.meta.api.methods;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief Type of parse modes for text in messages
|
* Type of parse modes for text in messages
|
||||||
* @date 10 of April of 2016
|
|
||||||
*/
|
*/
|
||||||
public class ParseMode {
|
public class ParseMode {
|
||||||
public static final String MARKDOWN = "Markdown";
|
public static final String MARKDOWN = "Markdown";
|
||||||
|
public static final String MARKDOWNV2 = "MarkdownV2";
|
||||||
public static final String HTML = "html";
|
public static final String HTML = "html";
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,129 @@
|
|||||||
|
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
|
||||||
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||||
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ruben Bermudez
|
||||||
|
* @version 4.5
|
||||||
|
* Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
|
||||||
|
* Returns True on success.
|
||||||
|
*/
|
||||||
|
public class SetChatAdministratorCustomTitle extends BotApiMethod<Boolean> {
|
||||||
|
public static final String PATH = "setChatAdministratorCustomTitle";
|
||||||
|
|
||||||
|
private static final String CHATID_FIELD = "chat_id";
|
||||||
|
private static final String USERID_FIELD = "user_id";
|
||||||
|
private static final String CUSTOMTITLE_FIELD = "custom_title";
|
||||||
|
|
||||||
|
@JsonProperty(CHATID_FIELD)
|
||||||
|
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
||||||
|
@JsonProperty(USERID_FIELD)
|
||||||
|
private Integer userId; ///< Unique identifier of the target user
|
||||||
|
@JsonProperty(CUSTOMTITLE_FIELD)
|
||||||
|
private String customTitle; ///< New custom title for the administrator; 0-16 characters, emoji are not allowed
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle(String chatId, Integer userId, String customTitle) {
|
||||||
|
super();
|
||||||
|
this.chatId = checkNotNull(chatId);
|
||||||
|
this.userId = checkNotNull(userId);
|
||||||
|
this.customTitle = checkNotNull(customTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle(Long chatId, Integer userId, String customTitle) {
|
||||||
|
super();
|
||||||
|
this.chatId = checkNotNull(chatId).toString();
|
||||||
|
this.userId = checkNotNull(userId);
|
||||||
|
this.customTitle = checkNotNull(customTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChatId() {
|
||||||
|
return chatId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle setChatId(String chatId) {
|
||||||
|
this.chatId = chatId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle setChatId(Long chatId) {
|
||||||
|
Objects.requireNonNull(chatId);
|
||||||
|
this.chatId = chatId.toString();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle setUserId(Integer userId) {
|
||||||
|
checkNotNull(userId);
|
||||||
|
this.userId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomTitle() {
|
||||||
|
return customTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SetChatAdministratorCustomTitle setCustomTitle(String customTitle) {
|
||||||
|
checkNotNull(customTitle);
|
||||||
|
this.customTitle = customTitle;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMethod() {
|
||||||
|
return PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||||
|
try {
|
||||||
|
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
|
||||||
|
new TypeReference<ApiResponse<Boolean>>(){});
|
||||||
|
if (result.getOk()) {
|
||||||
|
return result.getResult();
|
||||||
|
} else {
|
||||||
|
throw new TelegramApiRequestException("Error setting chat description", result);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate() throws TelegramApiValidationException {
|
||||||
|
if (chatId == null || chatId.isEmpty()) {
|
||||||
|
throw new TelegramApiValidationException("ChatId can't be empty", this);
|
||||||
|
}
|
||||||
|
if (userId == null || userId == 0) {
|
||||||
|
throw new TelegramApiValidationException("UserId can't be empty", this);
|
||||||
|
}
|
||||||
|
if (customTitle == null) {
|
||||||
|
throw new TelegramApiValidationException("CustomTitle can't be null", this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SetChatDescription{" +
|
||||||
|
"chatId='" + chatId + '\'' +
|
||||||
|
"userId='" + userId + '\'' +
|
||||||
|
", customTitle='" + customTitle + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -5,8 +5,8 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||||
import org.telegram.telegrambots.meta.api.methods.ParseMode;
|
import org.telegram.telegrambots.meta.api.methods.ParseMode;
|
||||||
import org.telegram.telegrambots.meta.api.objects.Message;
|
|
||||||
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
|
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
|
||||||
|
import org.telegram.telegrambots.meta.api.objects.Message;
|
||||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
|
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
@ -155,6 +155,15 @@ public class SendMessage extends BotApiMethod<Message> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SendMessage enableMarkdownV2(boolean enable) {
|
||||||
|
if (enable) {
|
||||||
|
this.parseMode = ParseMode.MARKDOWNV2;
|
||||||
|
} else {
|
||||||
|
this.parseMode = null;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMethod() {
|
public String getMethod() {
|
||||||
return PATH;
|
return PATH;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,6 +11,7 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
public class Audio implements BotApiObject {
|
public class Audio implements BotApiObject {
|
||||||
|
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String DURATION_FIELD = "duration";
|
private static final String DURATION_FIELD = "duration";
|
||||||
private static final String MIMETYPE_FIELD = "mime_type";
|
private static final String MIMETYPE_FIELD = "mime_type";
|
||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
@ -20,7 +20,13 @@ public class Audio implements BotApiObject {
|
|||||||
private static final String THUMB_FIELD = "thumb";
|
private static final String THUMB_FIELD = "thumb";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(DURATION_FIELD)
|
@JsonProperty(DURATION_FIELD)
|
||||||
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender
|
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender
|
||||||
@JsonProperty(MIMETYPE_FIELD)
|
@JsonProperty(MIMETYPE_FIELD)
|
||||||
@ -66,6 +72,10 @@ public class Audio implements BotApiObject {
|
|||||||
return thumb;
|
return thumb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Audio{" +
|
return "Audio{" +
|
||||||
@ -76,6 +86,7 @@ public class Audio implements BotApiObject {
|
|||||||
", title='" + title + '\'' +
|
", title='" + title + '\'' +
|
||||||
", performer='" + performer + '\'' +
|
", performer='" + performer + '\'' +
|
||||||
", thumb=" + thumb +
|
", thumb=" + thumb +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,6 +25,7 @@ public class Chat implements BotApiObject {
|
|||||||
private static final String STICKERSETNAME_FIELD = "sticker_set_name";
|
private static final String STICKERSETNAME_FIELD = "sticker_set_name";
|
||||||
private static final String CANSETSTICKERSET_FIELD = "can_set_sticker_set";
|
private static final String CANSETSTICKERSET_FIELD = "can_set_sticker_set";
|
||||||
private static final String PERMISSIONS_FIELD = "permissions";
|
private static final String PERMISSIONS_FIELD = "permissions";
|
||||||
|
private static final String SLOWMODEDELAY_FIELD = "slow_mode_delay";
|
||||||
|
|
||||||
private static final String USERCHATTYPE = "private";
|
private static final String USERCHATTYPE = "private";
|
||||||
private static final String GROUPCHATTYPE = "group";
|
private static final String GROUPCHATTYPE = "group";
|
||||||
@ -75,6 +75,13 @@ public class Chat implements BotApiObject {
|
|||||||
private Boolean canSetStickerSet; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat.
|
private Boolean canSetStickerSet; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat.
|
||||||
@JsonProperty(PERMISSIONS_FIELD)
|
@JsonProperty(PERMISSIONS_FIELD)
|
||||||
private ChatPermissions permissions; ///< Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
|
private ChatPermissions permissions; ///< Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
|
||||||
|
/**
|
||||||
|
* Optional.
|
||||||
|
* For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user.
|
||||||
|
* Returned only in getChat.
|
||||||
|
*/
|
||||||
|
@JsonProperty(SLOWMODEDELAY_FIELD)
|
||||||
|
private Integer slowModeDelay;
|
||||||
|
|
||||||
public Chat() {
|
public Chat() {
|
||||||
super();
|
super();
|
||||||
@ -152,6 +159,10 @@ public class Chat implements BotApiObject {
|
|||||||
return canSetStickerSet;
|
return canSetStickerSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSlowModeDelay() {
|
||||||
|
return slowModeDelay;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Chat{" +
|
return "Chat{" +
|
||||||
@ -169,6 +180,7 @@ public class Chat implements BotApiObject {
|
|||||||
", stickerSetName='" + stickerSetName + '\'' +
|
", stickerSetName='" + stickerSetName + '\'' +
|
||||||
", canSetStickerSet=" + canSetStickerSet +
|
", canSetStickerSet=" + canSetStickerSet +
|
||||||
", permissions=" + permissions +
|
", permissions=" + permissions +
|
||||||
|
", slowModeDelay=" + slowModeDelay +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -21,7 +20,7 @@ public class ChatMember implements BotApiObject {
|
|||||||
private static final String CANEDITMESSAGES_FIELD = "can_edit_messages";
|
private static final String CANEDITMESSAGES_FIELD = "can_edit_messages";
|
||||||
private static final String CANDELETEMESSAGES_FIELD = "can_delete_messages";
|
private static final String CANDELETEMESSAGES_FIELD = "can_delete_messages";
|
||||||
private static final String CANINVITEUSERS_FIELD = "can_invite_users";
|
private static final String CANINVITEUSERS_FIELD = "can_invite_users";
|
||||||
private static final String CANRESTRICTUSERS_FIELD = "can_restrict_users";
|
private static final String CANRESTRICTMEMBERS_FIELD = "can_restrict_members";
|
||||||
private static final String CANPINMESSAGES_FIELD = "can_pin_messages";
|
private static final String CANPINMESSAGES_FIELD = "can_pin_messages";
|
||||||
private static final String CANPROMOTEMEMBERS_FIELD = "can_promote_members";
|
private static final String CANPROMOTEMEMBERS_FIELD = "can_promote_members";
|
||||||
private static final String CANSENDMESSAGES_FIELD = "can_send_messages";
|
private static final String CANSENDMESSAGES_FIELD = "can_send_messages";
|
||||||
@ -30,6 +29,7 @@ public class ChatMember implements BotApiObject {
|
|||||||
private static final String CANADDWEBPAGEPREVIEWS_FIELD = "can_add_web_page_previews";
|
private static final String CANADDWEBPAGEPREVIEWS_FIELD = "can_add_web_page_previews";
|
||||||
private static final String CAN_SEND_POLLS_FIELD = "can_send_polls";
|
private static final String CAN_SEND_POLLS_FIELD = "can_send_polls";
|
||||||
private static final String ISMEMBER_FIELD = "is_member";
|
private static final String ISMEMBER_FIELD = "is_member";
|
||||||
|
private static final String CUSTOMTITLE_FIELD = "custom_title";
|
||||||
|
|
||||||
@JsonProperty(USER_FIELD)
|
@JsonProperty(USER_FIELD)
|
||||||
private User user; ///< Information about the user
|
private User user; ///< Information about the user
|
||||||
@ -49,8 +49,8 @@ public class ChatMember implements BotApiObject {
|
|||||||
private Boolean canDeleteMessages; ///< Optional. Administrators only. True, if the administrator can delete messages of other users
|
private Boolean canDeleteMessages; ///< Optional. Administrators only. True, if the administrator can delete messages of other users
|
||||||
@JsonProperty(CANINVITEUSERS_FIELD)
|
@JsonProperty(CANINVITEUSERS_FIELD)
|
||||||
private Boolean canInviteUsers; ///< Optional. Administrators and restricted only. True, if the administrator can invite new users to the chat
|
private Boolean canInviteUsers; ///< Optional. Administrators and restricted only. True, if the administrator can invite new users to the chat
|
||||||
@JsonProperty(CANRESTRICTUSERS_FIELD)
|
@JsonProperty(CANRESTRICTMEMBERS_FIELD)
|
||||||
private Boolean canRestrictUsers; ///< Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
|
private Boolean canRestrictMembers; ///< Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
|
||||||
@JsonProperty(CANPINMESSAGES_FIELD)
|
@JsonProperty(CANPINMESSAGES_FIELD)
|
||||||
private Boolean canPinMessages; ///< Optional. Administrators and restricted only. True, if the administrator can pin messages, groups and supergroups only
|
private Boolean canPinMessages; ///< Optional. Administrators and restricted only. True, if the administrator can pin messages, groups and supergroups only
|
||||||
@JsonProperty(CANPROMOTEMEMBERS_FIELD)
|
@JsonProperty(CANPROMOTEMEMBERS_FIELD)
|
||||||
@ -67,6 +67,8 @@ public class ChatMember implements BotApiObject {
|
|||||||
private Boolean canSendPolls; ///< Optional. Restricted only. True, if the user is allowed to send polls.
|
private Boolean canSendPolls; ///< Optional. Restricted only. True, if the user is allowed to send polls.
|
||||||
@JsonProperty(ISMEMBER_FIELD)
|
@JsonProperty(ISMEMBER_FIELD)
|
||||||
private Boolean isMemberField; ///< True, if the user is a member of the chat at the moment of the request. For example, it can be false for the chat creator or for a restricted user.
|
private Boolean isMemberField; ///< True, if the user is a member of the chat at the moment of the request. For example, it can be false for the chat creator or for a restricted user.
|
||||||
|
@JsonProperty(CUSTOMTITLE_FIELD)
|
||||||
|
private String customTitle; ///< Optional. Owner and administrators only. Custom title for this user
|
||||||
|
|
||||||
public ChatMember() {
|
public ChatMember() {
|
||||||
super();
|
super();
|
||||||
@ -115,8 +117,16 @@ public class ChatMember implements BotApiObject {
|
|||||||
return canInviteUsers;
|
return canInviteUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getCanRestrictMembers() {
|
||||||
|
return canRestrictMembers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {{@link #getCanRestrictMembers()}}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public Boolean getCanRestrictUsers() {
|
public Boolean getCanRestrictUsers() {
|
||||||
return canRestrictUsers;
|
return canRestrictMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getCanPinMessages() {
|
public Boolean getCanPinMessages() {
|
||||||
@ -151,6 +161,10 @@ public class ChatMember implements BotApiObject {
|
|||||||
return isMemberField;
|
return isMemberField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCustomTitle() {
|
||||||
|
return customTitle;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ChatMember{" +
|
return "ChatMember{" +
|
||||||
@ -163,7 +177,7 @@ public class ChatMember implements BotApiObject {
|
|||||||
", canEditMessages=" + canEditMessages +
|
", canEditMessages=" + canEditMessages +
|
||||||
", canDeleteMessages=" + canDeleteMessages +
|
", canDeleteMessages=" + canDeleteMessages +
|
||||||
", canInviteUsers=" + canInviteUsers +
|
", canInviteUsers=" + canInviteUsers +
|
||||||
", canRestrictUsers=" + canRestrictUsers +
|
", canRestrictMembers=" + canRestrictMembers +
|
||||||
", canPinMessages=" + canPinMessages +
|
", canPinMessages=" + canPinMessages +
|
||||||
", canPromoteMembers=" + canPromoteMembers +
|
", canPromoteMembers=" + canPromoteMembers +
|
||||||
", canSendMessages=" + canSendMessages +
|
", canSendMessages=" + canSendMessages +
|
||||||
@ -172,6 +186,7 @@ public class ChatMember implements BotApiObject {
|
|||||||
", canAddWebPagePreviews=" + canAddWebPagePreviews +
|
", canAddWebPagePreviews=" + canAddWebPagePreviews +
|
||||||
", canSendPolls=" + canSendPolls +
|
", canSendPolls=" + canSendPolls +
|
||||||
", isMemberField=" + isMemberField +
|
", isMemberField=" + isMemberField +
|
||||||
|
", customTitle=" + customTitle +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,20 +10,36 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
*/
|
*/
|
||||||
public class ChatPhoto implements BotApiObject {
|
public class ChatPhoto implements BotApiObject {
|
||||||
private static final String SMALLFILEID_FIELD = "small_file_id";
|
private static final String SMALLFILEID_FIELD = "small_file_id";
|
||||||
|
private static final String SMALLFILEUNIQUEID_FIELD = "small_file_unique_id";
|
||||||
private static final String BIGFILEID_FIELD = "big_file_id";
|
private static final String BIGFILEID_FIELD = "big_file_id";
|
||||||
|
private static final String BIGFILEUNIQUEID_FIELD = "big_file_unique_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique file identifier of a small chat photo (160x160).
|
* File identifier of small (160x160) chat photo.
|
||||||
* This file_id can be used only for photo download and only for as long as the photo is not changed.
|
* This file_id can be used only for photo download and only for as long as the photo is not changed.
|
||||||
*/
|
*/
|
||||||
@JsonProperty(SMALLFILEID_FIELD)
|
@JsonProperty(SMALLFILEID_FIELD)
|
||||||
private String smallFileId;
|
private String smallFileId;
|
||||||
/**
|
/**
|
||||||
* Unique file identifier of a big chat photo (640x640).
|
* Unique file identifier of small (160x160) chat photo,
|
||||||
|
* which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(SMALLFILEUNIQUEID_FIELD)
|
||||||
|
private String smallFileUniqueId;
|
||||||
|
/**
|
||||||
|
* File identifier of big (640x640) chat photo.
|
||||||
* This file_id can be used only for photo download and only for as long as the photo is not changed.
|
* This file_id can be used only for photo download and only for as long as the photo is not changed.
|
||||||
*/
|
*/
|
||||||
@JsonProperty(BIGFILEID_FIELD)
|
@JsonProperty(BIGFILEID_FIELD)
|
||||||
private String bigFileId;
|
private String bigFileId;
|
||||||
|
/**
|
||||||
|
* Unique file identifier of big (640x640) chat photo,
|
||||||
|
* which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(BIGFILEUNIQUEID_FIELD)
|
||||||
|
private String bigFileUniqueId;
|
||||||
|
|
||||||
public ChatPhoto() {
|
public ChatPhoto() {
|
||||||
super();
|
super();
|
||||||
@ -37,11 +53,21 @@ public class ChatPhoto implements BotApiObject {
|
|||||||
return bigFileId;
|
return bigFileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSmallFileUniqueId() {
|
||||||
|
return smallFileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBigFileUniqueId() {
|
||||||
|
return bigFileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ChatPhoto{" +
|
return "ChatPhoto{" +
|
||||||
"smallFileId='" + smallFileId + '\'' +
|
"smallFileId='" + smallFileId + '\'' +
|
||||||
|
", smallFileUniqueId='" + smallFileUniqueId + '\'' +
|
||||||
", bigFileId='" + bigFileId + '\'' +
|
", bigFileId='" + bigFileId + '\'' +
|
||||||
|
", bigFileUniqueId='" + bigFileUniqueId + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,13 +13,20 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
public class Document implements BotApiObject {
|
public class Document implements BotApiObject {
|
||||||
|
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String THUMB_FIELD = "thumb";
|
private static final String THUMB_FIELD = "thumb";
|
||||||
private static final String FILENAME_FIELD = "file_name";
|
private static final String FILENAME_FIELD = "file_name";
|
||||||
private static final String MIMETYPE_FIELD = "mime_type";
|
private static final String MIMETYPE_FIELD = "mime_type";
|
||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(THUMB_FIELD)
|
@JsonProperty(THUMB_FIELD)
|
||||||
private PhotoSize thumb; ///< Document thumbnail as defined by sender
|
private PhotoSize thumb; ///< Document thumbnail as defined by sender
|
||||||
@JsonProperty(FILENAME_FIELD)
|
@JsonProperty(FILENAME_FIELD)
|
||||||
@ -54,6 +60,10 @@ public class Document implements BotApiObject {
|
|||||||
return fileSize;
|
return fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Document{" +
|
return "Document{" +
|
||||||
@ -62,6 +72,7 @@ public class Document implements BotApiObject {
|
|||||||
", fileName='" + fileName + '\'' +
|
", fileName='" + fileName + '\'' +
|
||||||
", mimeType='" + mimeType + '\'' +
|
", mimeType='" + mimeType + '\'' +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
@ -14,12 +13,19 @@ import java.text.MessageFormat;
|
|||||||
* @date 24 of June of 2015
|
* @date 24 of June of 2015
|
||||||
*/
|
*/
|
||||||
public class File implements BotApiObject {
|
public class File implements BotApiObject {
|
||||||
private static final String FILE_ID = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String FILE_SIZE_FIELD = "file_size";
|
private static final String FILE_SIZE_FIELD = "file_size";
|
||||||
private static final String FILE_PATH_FIELD = "file_path";
|
private static final String FILE_PATH_FIELD = "file_path";
|
||||||
|
|
||||||
@JsonProperty(FILE_ID)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(FILE_SIZE_FIELD)
|
@JsonProperty(FILE_SIZE_FIELD)
|
||||||
private Integer fileSize; ///< Optional. File size, if known
|
private Integer fileSize; ///< Optional. File size, if known
|
||||||
@JsonProperty(FILE_PATH_FIELD)
|
@JsonProperty(FILE_PATH_FIELD)
|
||||||
@ -41,13 +47,8 @@ public class File implements BotApiObject {
|
|||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String getFileUniqueId() {
|
||||||
public String toString() {
|
return fileUniqueId;
|
||||||
return "File{" +
|
|
||||||
"fileId='" + fileId + '\'' +
|
|
||||||
", fileSize=" + fileSize +
|
|
||||||
", filePath='" + filePath + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileUrl(String botToken) {
|
public String getFileUrl(String botToken) {
|
||||||
@ -60,4 +61,14 @@ public class File implements BotApiObject {
|
|||||||
}
|
}
|
||||||
return MessageFormat.format("https://api.telegram.org/file/bot{0}/{1}", botToken, filePath);
|
return MessageFormat.format("https://api.telegram.org/file/bot{0}/{1}", botToken, filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "File{" +
|
||||||
|
"fileId='" + fileId + '\'' +
|
||||||
|
", fileSize=" + fileSize +
|
||||||
|
", filePath='" + filePath + '\'' +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
|||||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,4 +107,22 @@ public class LoginUrl implements InputBotApiObject, Validable {
|
|||||||
", requestWriteAccess=" + requestWriteAccess +
|
", requestWriteAccess=" + requestWriteAccess +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof LoginUrl)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
LoginUrl loginUrl = (LoginUrl) o;
|
||||||
|
return Objects.equals(url, loginUrl.url) &&
|
||||||
|
Objects.equals(forwardText, loginUrl.forwardText) &&
|
||||||
|
Objects.equals(botUsername, loginUrl.botUsername) &&
|
||||||
|
Objects.equals(requestWriteAccess, loginUrl.requestWriteAccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(url, forwardText, botUsername, requestWriteAccess);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.telegram.telegrambots.meta.api.objects;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,8 +30,10 @@ public class MessageEntity implements BotApiObject {
|
|||||||
* italic (italic text),
|
* italic (italic text),
|
||||||
* code (monowidth string),
|
* code (monowidth string),
|
||||||
* pre (monowidth block),
|
* pre (monowidth block),
|
||||||
* text_link (for clickable text URLs)
|
* text_link (for clickable text URLs),
|
||||||
* text_mention (for users without usernames)
|
* text_mention (for users without usernames),
|
||||||
|
* underline,
|
||||||
|
* strikethrough
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@JsonProperty(TYPE_FIELD)
|
@JsonProperty(TYPE_FIELD)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,13 +12,20 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
public class PhotoSize implements BotApiObject {
|
public class PhotoSize implements BotApiObject {
|
||||||
|
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String WIDTH_FIELD = "width";
|
private static final String WIDTH_FIELD = "width";
|
||||||
private static final String HEIGHT_FIELD = "height";
|
private static final String HEIGHT_FIELD = "height";
|
||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
private static final String FILEPATH_FIELD = "file_path";
|
private static final String FILEPATH_FIELD = "file_path";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(WIDTH_FIELD)
|
@JsonProperty(WIDTH_FIELD)
|
||||||
private Integer width; ///< Photo width
|
private Integer width; ///< Photo width
|
||||||
@JsonProperty(HEIGHT_FIELD)
|
@JsonProperty(HEIGHT_FIELD)
|
||||||
@ -57,6 +63,10 @@ public class PhotoSize implements BotApiObject {
|
|||||||
return filePath != null && !filePath.isEmpty();
|
return filePath != null && !filePath.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PhotoSize{" +
|
return "PhotoSize{" +
|
||||||
@ -64,6 +74,7 @@ public class PhotoSize implements BotApiObject {
|
|||||||
", width=" + width +
|
", width=" + width +
|
||||||
", height=" + height +
|
", height=" + height +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,6 +12,7 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
public class Video implements BotApiObject {
|
public class Video implements BotApiObject {
|
||||||
|
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String WIDTH_FIELD = "width";
|
private static final String WIDTH_FIELD = "width";
|
||||||
private static final String HEIGHT_FIELD = "height";
|
private static final String HEIGHT_FIELD = "height";
|
||||||
private static final String DURATION_FIELD = "duration";
|
private static final String DURATION_FIELD = "duration";
|
||||||
@ -21,7 +21,13 @@ public class Video implements BotApiObject {
|
|||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(WIDTH_FIELD)
|
@JsonProperty(WIDTH_FIELD)
|
||||||
private Integer width; ///< Video width as defined by sender
|
private Integer width; ///< Video width as defined by sender
|
||||||
@JsonProperty(HEIGHT_FIELD)
|
@JsonProperty(HEIGHT_FIELD)
|
||||||
@ -67,6 +73,10 @@ public class Video implements BotApiObject {
|
|||||||
return fileSize;
|
return fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Video{" +
|
return "Video{" +
|
||||||
@ -77,6 +87,7 @@ public class Video implements BotApiObject {
|
|||||||
", thumb=" + thumb +
|
", thumb=" + thumb +
|
||||||
", mimeType='" + mimeType + '\'' +
|
", mimeType='" + mimeType + '\'' +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,20 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
*/
|
*/
|
||||||
public class VideoNote implements BotApiObject {
|
public class VideoNote implements BotApiObject {
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String LENGTH_FIELD = "length";
|
private static final String LENGTH_FIELD = "length";
|
||||||
private static final String DURATION_FIELD = "duration";
|
private static final String DURATION_FIELD = "duration";
|
||||||
private static final String THUMB_FIELD = "thumb";
|
private static final String THUMB_FIELD = "thumb";
|
||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(LENGTH_FIELD)
|
@JsonProperty(LENGTH_FIELD)
|
||||||
private Integer length; ///< Video width and height as defined by sender
|
private Integer length; ///< Video width and height as defined by sender
|
||||||
@JsonProperty(DURATION_FIELD)
|
@JsonProperty(DURATION_FIELD)
|
||||||
@ -51,6 +58,10 @@ public class VideoNote implements BotApiObject {
|
|||||||
return fileSize;
|
return fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VideoNote{" +
|
return "VideoNote{" +
|
||||||
@ -59,6 +70,7 @@ public class VideoNote implements BotApiObject {
|
|||||||
", duration=" + duration +
|
", duration=" + duration +
|
||||||
", thumb=" + thumb +
|
", thumb=" + thumb +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects;
|
package org.telegram.telegrambots.meta.api.objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,12 +11,19 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
*/
|
*/
|
||||||
public class Voice implements BotApiObject {
|
public class Voice implements BotApiObject {
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String DURATION_FIELD = "duration";
|
private static final String DURATION_FIELD = "duration";
|
||||||
private static final String MIMETYPE_FIELD = "mime_type";
|
private static final String MIMETYPE_FIELD = "mime_type";
|
||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(DURATION_FIELD)
|
@JsonProperty(DURATION_FIELD)
|
||||||
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender
|
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender
|
||||||
@JsonProperty(MIMETYPE_FIELD)
|
@JsonProperty(MIMETYPE_FIELD)
|
||||||
@ -45,6 +51,10 @@ public class Voice implements BotApiObject {
|
|||||||
return fileSize;
|
return fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Voice{" +
|
return "Voice{" +
|
||||||
@ -52,6 +62,7 @@ public class Voice implements BotApiObject {
|
|||||||
", duration=" + duration +
|
", duration=" + duration +
|
||||||
", mimeType='" + mimeType + '\'' +
|
", mimeType='" + mimeType + '\'' +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects.games;
|
package org.telegram.telegrambots.meta.api.objects.games;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
||||||
|
|
||||||
@ -28,6 +27,7 @@ import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
|||||||
*/
|
*/
|
||||||
public class Animation implements BotApiObject {
|
public class Animation implements BotApiObject {
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String WIDTH_FIELD = "width";
|
private static final String WIDTH_FIELD = "width";
|
||||||
private static final String HEIGHT_FIELD = "height";
|
private static final String HEIGHT_FIELD = "height";
|
||||||
private static final String DURATION_FIELD = "duration";
|
private static final String DURATION_FIELD = "duration";
|
||||||
@ -37,7 +37,13 @@ public class Animation implements BotApiObject {
|
|||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique file identifier
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(WIDTH_FIELD)
|
@JsonProperty(WIDTH_FIELD)
|
||||||
private Integer width; ///< Video width as defined by sender
|
private Integer width; ///< Video width as defined by sender
|
||||||
@JsonProperty(HEIGHT_FIELD)
|
@JsonProperty(HEIGHT_FIELD)
|
||||||
@ -89,6 +95,10 @@ public class Animation implements BotApiObject {
|
|||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Animation{" +
|
return "Animation{" +
|
||||||
@ -100,6 +110,7 @@ public class Animation implements BotApiObject {
|
|||||||
", fileName='" + fileName + '\'' +
|
", fileName='" + fileName + '\'' +
|
||||||
", mimetype='" + mimetype + '\'' +
|
", mimetype='" + mimetype + '\'' +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,4 +34,14 @@ public class CallbackGame implements BotApiObject {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "CallbackGame{}";
|
return "CallbackGame{}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return o == this || o instanceof CallbackGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return getClass().hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,18 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|||||||
*/
|
*/
|
||||||
public class PassportFile implements BotApiObject {
|
public class PassportFile implements BotApiObject {
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String FILESIZE_FIELD = "file_size";
|
private static final String FILESIZE_FIELD = "file_size";
|
||||||
private static final String FILEDATE_FIELD = "file_date";
|
private static final String FILEDATE_FIELD = "file_date";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(FILESIZE_FIELD)
|
@JsonProperty(FILESIZE_FIELD)
|
||||||
private Integer fileSize; ///< File size
|
private Integer fileSize; ///< File size
|
||||||
@JsonProperty(FILEDATE_FIELD)
|
@JsonProperty(FILEDATE_FIELD)
|
||||||
@ -42,12 +49,17 @@ public class PassportFile implements BotApiObject {
|
|||||||
return fileDate;
|
return fileDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PassportFile{" +
|
return "PassportFile{" +
|
||||||
"fileId='" + fileId + '\'' +
|
"fileId='" + fileId + '\'' +
|
||||||
", fileSize=" + fileSize +
|
", fileSize=" + fileSize +
|
||||||
", fileDate=" + fileDate +
|
", fileDate=" + fileDate +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,11 @@ public class InlineKeyboardMarkup implements ReplyKeyboard {
|
|||||||
keyboard = new ArrayList<>();
|
keyboard = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InlineKeyboardMarkup(List<List<InlineKeyboardButton>> keyboard) {
|
||||||
|
super();
|
||||||
|
this.keyboard = keyboard;
|
||||||
|
}
|
||||||
|
|
||||||
public List<List<InlineKeyboardButton>> getKeyboard() {
|
public List<List<InlineKeyboardButton>> getKeyboard() {
|
||||||
return keyboard;
|
return keyboard;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,11 @@ public class ReplyKeyboardMarkup implements ReplyKeyboard {
|
|||||||
keyboard = new ArrayList<>();
|
keyboard = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReplyKeyboardMarkup(List<KeyboardRow> keyboard) {
|
||||||
|
super();
|
||||||
|
this.keyboard = keyboard;
|
||||||
|
}
|
||||||
|
|
||||||
public List<KeyboardRow> getKeyboard() {
|
public List<KeyboardRow> getKeyboard() {
|
||||||
return keyboard;
|
return keyboard;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.objects.stickers;
|
package org.telegram.telegrambots.meta.api.objects.stickers;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||||
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
||||||
|
|
||||||
@ -13,6 +12,7 @@ import org.telegram.telegrambots.meta.api.objects.PhotoSize;
|
|||||||
public class Sticker implements BotApiObject {
|
public class Sticker implements BotApiObject {
|
||||||
|
|
||||||
private static final String FILEID_FIELD = "file_id";
|
private static final String FILEID_FIELD = "file_id";
|
||||||
|
private static final String FILEUNIQUEID_FIELD = "file_unique_id";
|
||||||
private static final String WIDTH_FIELD = "width";
|
private static final String WIDTH_FIELD = "width";
|
||||||
private static final String HEIGHT_FIELD = "height";
|
private static final String HEIGHT_FIELD = "height";
|
||||||
private static final String THUMB_FIELD = "thumb";
|
private static final String THUMB_FIELD = "thumb";
|
||||||
@ -23,7 +23,13 @@ public class Sticker implements BotApiObject {
|
|||||||
private static final String ISANIMATED_FIELD = "is_animated";
|
private static final String ISANIMATED_FIELD = "is_animated";
|
||||||
|
|
||||||
@JsonProperty(FILEID_FIELD)
|
@JsonProperty(FILEID_FIELD)
|
||||||
private String fileId; ///< Unique identifier for this file
|
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
|
||||||
|
/**
|
||||||
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots.
|
||||||
|
* Can't be used to download or reuse the file.
|
||||||
|
*/
|
||||||
|
@JsonProperty(FILEUNIQUEID_FIELD)
|
||||||
|
private String fileUniqueId;
|
||||||
@JsonProperty(WIDTH_FIELD)
|
@JsonProperty(WIDTH_FIELD)
|
||||||
private Integer width; ///< Sticker width
|
private Integer width; ///< Sticker width
|
||||||
@JsonProperty(HEIGHT_FIELD)
|
@JsonProperty(HEIGHT_FIELD)
|
||||||
@ -81,6 +87,10 @@ public class Sticker implements BotApiObject {
|
|||||||
return isAnimated;
|
return isAnimated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileUniqueId() {
|
||||||
|
return fileUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Sticker{" +
|
return "Sticker{" +
|
||||||
@ -93,6 +103,7 @@ public class Sticker implements BotApiObject {
|
|||||||
", setName='" + setName + '\'' +
|
", setName='" + setName + '\'' +
|
||||||
", maskPosition=" + maskPosition +
|
", maskPosition=" + maskPosition +
|
||||||
", isAnimated=" + isAnimated +
|
", isAnimated=" + isAnimated +
|
||||||
|
", fileUniqueId=" + fileUniqueId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegrambots-spring-boot-starter</artifactId>
|
<artifactId>telegrambots-spring-boot-starter</artifactId>
|
||||||
@ -78,7 +78,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
@ -95,7 +95,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots-meta</artifactId>
|
<artifactId>telegrambots-meta</artifactId>
|
||||||
<version>4.4.0.2</version>
|
<version>4.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
Loading…
Reference in New Issue
Block a user