diff --git a/.gitignore b/.gitignore
index 737c7ac7..c0b06615 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,6 @@ copyright/
#File System specific files
.DS_STORE
+
+# Default ignored files
+/Bots.iws
\ No newline at end of file
diff --git a/Bots.ipr b/Bots.ipr
index 48a1815b..33b4badd 100644
--- a/Bots.ipr
+++ b/Bots.ipr
@@ -506,10 +506,18 @@
+
+
+
+
+
+
+
+
@@ -898,81 +906,70 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1008,15 +1005,15 @@
-
+
-
+
-
+
-
+
@@ -1129,37 +1126,48 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1184,17 +1192,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1250,158 +1247,169 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1415,15 +1423,15 @@
-
+
-
+
-
+
-
+
@@ -1437,15 +1445,15 @@
-
+
-
+
-
+
-
+
@@ -1525,59 +1533,59 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -1591,147 +1599,147 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -1800,48 +1808,48 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -1866,26 +1874,26 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -1910,114 +1918,114 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/README.md b/README.md
index 5d45b712..d66ba1f3 100644
--- a/README.md
+++ b/README.md
@@ -27,16 +27,16 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambots
- 4.4.0
+ 4.4.0.2
```
```gradle
- compile "org.telegram:telegrambots:4.4.0"
+ compile "org.telegram:telegrambots:4.4.0.2"
```
- 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.4.0)
- 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.4.0)
+ 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.4.0.2)
+ 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.4.0.2)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md
index d234ab7c..e568d16a 100644
--- a/TelegramBots.wiki/Changelog.md
+++ b/TelegramBots.wiki/Changelog.md
@@ -1,3 +1,14 @@
+### 4.4.0.2 ###
+1. Use SLF4J
+2. Support case-insensitive usernames
+3. Add Ability toggles and export default abilities to their own class
+4. Add state machine capability to AbilityBot via ReplyFlow
+5. Support backup and recovery of db vars
+6. Fixes: #602, #641, #652, #691
+
+### 4.4.0.1 ###
+1. Bug fix when importing the project
+
### 4.4.0 ###
1. Update Api version [4.4](https://core.telegram.org/bots/api-changelog#july-29-2019)
2. Removed BotLogger, replaced with [log4j2](https://logging.apache.org/log4j/2.x/)
diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md
index e0878bbe..64a63865 100644
--- a/TelegramBots.wiki/Getting-Started.md
+++ b/TelegramBots.wiki/Getting-Started.md
@@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
org.telegram
telegrambots
- 4.4.0
+ 4.4.0.2
```
* With **Gradle**:
```groovy
- compile group: 'org.telegram', name: 'telegrambots', version: '4.4.0'
+ compile group: 'org.telegram', name: 'telegrambots', version: '4.4.0.2'
```
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
diff --git a/TelegramBots.wiki/How-To-Update.md b/TelegramBots.wiki/How-To-Update.md
index 0bc9c26b..11fe80e8 100644
--- a/TelegramBots.wiki/How-To-Update.md
+++ b/TelegramBots.wiki/How-To-Update.md
@@ -1,3 +1,6 @@
+### To version 4.4.0.2 ###
+1. Logging framework has been replaced by slf4j, so now you'll need to manage your own implementation.
+
### To version 4.0.0 ###
1. Replace removed method from AbsSender with `execute` requests.
2. Everything under "Telegrambots-meta" has been moved to package `org.telegram.telegrambots.meta`.
diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md
index 3aa89b8a..f541cd66 100644
--- a/TelegramBots.wiki/abilities/Simple-Example.md
+++ b/TelegramBots.wiki/abilities/Simple-Example.md
@@ -9,7 +9,7 @@ As with any Java project, you will need to set your dependencies.
org.telegram
telegrambots-abilities
- 4.4.0
+ 4.4.0.2
```
* **Gradle**
diff --git a/pom.xml b/pom.xml
index 37193d47..fb6636f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
pom
- 4.4.0
+ 4.4.0.2
telegrambots
@@ -26,20 +26,54 @@
+ Bots
+ https://github.com/rubenlagus/TelegramBots
+ Easy to use library to create Telegram Bots
+
+
+ https://github.com/rubenlagus/TelegramBots/issues
+ GitHub Issues
+
+
+
+ https://github.com/rubenlagus/TelegramBots
+ scm:git:git://github.com/rubenlagus/TelegramBots.git
+ scm:git:git@github.com:rubenlagus/TelegramBots.git
+
+
+
+
+ rberlopez@gmail.com
+ Ruben Bermudez
+ https://github.com/rubenlagus
+ rubenlagus
+
+
+
+
+
+ ossrh
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
11
8
${java.version}
${java.version}
- true
-
- 5.5.1
- 3.0.0
- 3.0.0
- 2.9.9
- 2.9.9.1
- 2.12.0
+ 5.5.2
+ 3.1.0
+ 3.1.0
+ 2.10.1
+ 2.10.1
+ 1.7.29
+ 1.3.5
@@ -78,9 +112,15 @@
${jackson.version}
- org.apache.logging.log4j
- log4j-core
- ${log4j.version}
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+
+ jakarta.annotation
+ jakarta.annotation-api
+ ${jakarta.annotation.version}
@@ -108,9 +148,57 @@
- org.apache.logging.log4j
- log4j-core
- ${log4j.version}
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+ ossrh
+ https://oss.sonatype.org/
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.0.0-M2
+
+
+ enforce-versions
+
+ enforce
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md
index d43fa96c..d4d1401a 100644
--- a/telegrambots-abilities/README.md
+++ b/telegrambots-abilities/README.md
@@ -18,19 +18,19 @@ Usage
org.telegram
telegrambots-abilities
- 4.4.0
+ 4.4.0.2
```
**Gradle**
```gradle
- compile "org.telegram:telegrambots-abilities:4.4.0"
+ compile "org.telegram:telegrambots-abilities:4.4.0.2"
```
-**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.4.0)
+**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.4.0.2)
-**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.4.0)
+**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.4.0.2)
Motivation
----------
diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index 9f8dc9b5..20599cad 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.4.0
+ 4.4.0.2
telegrambots-abilities
@@ -78,13 +78,14 @@
3.9
3.0.7
+ 2.12.1
org.telegram
telegrambots
- 4.4.0
+ 4.4.0.2
org.apache.commons
@@ -102,6 +103,16 @@
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ ${log4j.version}
+
+
+ org.apache.logging.log4j
+ log4j-core
+ ${log4j.version}
+
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
index ae1ffda2..a237616d 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
@@ -3,9 +3,12 @@ package org.telegram.abilitybots.api.bot;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableMap;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Multimap;
+import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.abilitybots.api.db.DBContext;
import org.telegram.abilitybots.api.objects.*;
import org.telegram.abilitybots.api.sender.DefaultSender;
@@ -79,7 +82,7 @@ import static org.telegram.abilitybots.api.util.AbilityUtils.*;
*/
@SuppressWarnings({"ConfusingArgumentToVarargsMethod", "UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"})
public abstract class BaseAbilityBot extends DefaultAbsSender implements AbilityExtension {
- private static final Logger log = LogManager.getLogger(BaseAbilityBot.class);
+ private static final Logger log = LoggerFactory.getLogger(BaseAbilityBot.class);
protected static final String DEFAULT = "default";
// DB objects
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/MapDBContext.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/MapDBContext.java
index ab0fa07f..bd5ef14c 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/MapDBContext.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/MapDBContext.java
@@ -3,12 +3,12 @@ package org.telegram.abilitybots.api.db;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.mapdb.Atomic;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.mapdb.Serializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.abilitybots.api.util.Pair;
import java.io.IOException;
@@ -30,7 +30,7 @@ import static org.mapdb.Serializer.JAVA;
*/
@SuppressWarnings({"unchecked", "WeakerAccess"})
public class MapDBContext implements DBContext {
- private static final Logger log = LogManager.getLogger(MapDBContext.class);
+ private static final Logger log = LoggerFactory.getLogger(MapDBContext.class);
private final DB db;
private final ObjectMapper objectMapper;
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Ability.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Ability.java
index db2db4c3..f9ddcd71 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Ability.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Ability.java
@@ -2,8 +2,8 @@ package org.telegram.abilitybots.api.objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.telegrambots.meta.api.objects.Update;
import java.util.Arrays;
@@ -35,7 +35,7 @@ import static org.apache.commons.lang3.StringUtils.*;
* @author Abbas Abou Daya
*/
public final class Ability {
- private static final Logger log = LogManager.getLogger(Ability.class);
+ private static final Logger log = LoggerFactory.getLogger(Ability.class);
private final String name;
private final String info;
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java
index bc87c328..0e3aeb6c 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java
@@ -1,7 +1,7 @@
package org.telegram.abilitybots.api.sender;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -19,7 +19,7 @@ import java.util.Optional;
* @author Abbas Abou Daya
*/
public class SilentSender {
- private static final Logger log = LogManager.getLogger(SilentSender.class);
+ private static final Logger log = LoggerFactory.getLogger(SilentSender.class);
private final MessageSender sender;
diff --git a/telegrambots-abilities/src/test/resources/log4j2-test.xml b/telegrambots-abilities/src/test/resources/log4j2-test.xml
new file mode 100644
index 00000000..8054f7f7
--- /dev/null
+++ b/telegrambots-abilities/src/test/resources/log4j2-test.xml
@@ -0,0 +1,19 @@
+
+
+
+ %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%t] %-5level %logger{36} - %msg%n
+ App
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index 212ceb0a..095f2bc9 100644
--- a/telegrambots-chat-session-bot/README.md
+++ b/telegrambots-chat-session-bot/README.md
@@ -15,7 +15,7 @@ Usage
org.telegram
telegrambots-chat-session-bot
- 4.4.0
+ 4.4.0.2
```
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index 3765c8f4..fef0e5d2 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.4.0
+ 4.4.0.2
telegrambots-chat-session-bot
@@ -76,7 +76,7 @@
UTF-8
UTF-8
- 1.4.1
+ 1.4.2
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 4.4.0
+ 4.4.0.2
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index 6e1d2173..72abbcf3 100644
--- a/telegrambots-extensions/README.md
+++ b/telegrambots-extensions/README.md
@@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambotsextensions
- 4.4.0
+ 4.4.0.2
```
2. Using Gradle:
```gradle
- compile "org.telegram:telegrambotsextensions:4.4.0"
+ compile "org.telegram:telegrambotsextensions:4.4.0.2"
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index b5990489..8c346d7e 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.4.0
+ 4.4.0.2
telegrambotsextensions
@@ -75,7 +75,7 @@
org.telegram
telegrambots
- 4.4.0
+ 4.4.0.2
diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java
index 8bb39742..1796b364 100644
--- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java
+++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java
@@ -28,10 +28,22 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* Creates a TelegramLongPollingCommandBot using default options
* Use ICommandRegistry's methods on this bot to register commands
*
- * @param botUsername Username of the bot
*/
- public TelegramLongPollingCommandBot(String botUsername) {
- this(ApiContext.getInstance(DefaultBotOptions.class), botUsername);
+ public TelegramLongPollingCommandBot() {
+ this(ApiContext.getInstance(DefaultBotOptions.class));
+ }
+
+ /**
+ * Creates a TelegramLongPollingCommandBot using default options
+ * Use ICommandRegistry's methods on this bot to register commands
+ *
+ * @param botUsername Username of the bot
+ * @deprecated Overwrite {@link #getBotUsername() getBotUsername} instead
+ */
+ @Deprecated
+ public TelegramLongPollingCommandBot(String botUsername){
+ this();
+ this.botUsername = botUsername;
}
/**
@@ -40,10 +52,9 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* Use ICommandRegistry's methods on this bot to register commands
*
* @param options Bot options
- * @param botUsername Username of the bot
*/
- public TelegramLongPollingCommandBot(DefaultBotOptions options, String botUsername) {
- this(options, true, botUsername);
+ public TelegramLongPollingCommandBot(DefaultBotOptions options) {
+ this(options, true);
}
/**
@@ -53,12 +64,10 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* @param options Bot options
* @param allowCommandsWithUsername true to allow commands with parameters (default),
* false otherwise
- * @param botUsername bot username of this bot
*/
- public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername, String botUsername) {
+ public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername) {
super(options);
- this.botUsername = botUsername;
- this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, botUsername);
+ this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this.getBotUsername());
}
@Override
@@ -143,9 +152,9 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* @return Bot username
*/
@Override
- public final String getBotUsername() {
- return botUsername;
- }
+ public String getBotUsername(){
+ return this.botUsername;
+ };
/**
* Process all updates, that are not commands.
diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java
index fdd3771b..f06e15fb 100644
--- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java
+++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java
@@ -8,6 +8,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
+import java.util.regex.Pattern;
/**
* This class manages all the commands for a bot. You can register and deregister commands on demand
@@ -122,7 +123,7 @@ public final class CommandRegistry implements ICommandRegistry {
*/
private String removeUsernameFromCommandIfNeeded(String command) {
if (allowCommandsWithUsername) {
- return command.replace("@" + botUsername, "").trim();
+ return command.replaceAll("(?i)@" + Pattern.quote(botUsername), "").trim();
}
return command;
}
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index c2eb4616..a6167035 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.4.0
+ 4.4.0.2
telegrambots-meta
@@ -70,10 +70,10 @@
UTF-8
UTF-8
4.2.2
- 2.9.9
- 2.9.9
+ 2.10.1
+ 2.10.1
20180813
- 28.0-jre
+ 28.1-jre
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/ApiContext.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/ApiContext.java
index a5a2e0ce..3859fa91 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/ApiContext.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/ApiContext.java
@@ -4,8 +4,8 @@ import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Singleton;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.text.MessageFormat;
import java.util.HashMap;
@@ -16,7 +16,7 @@ import java.util.Map;
* @version 1.0
*/
public class ApiContext {
- private static final Logger log = LogManager.getLogger(ApiContext.class);
+ private static final Logger log = LoggerFactory.getLogger(ApiContext.class);
private static final Object lock = new Object();
private static Injector INJECTOR;
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java
index 7a42bd41..97c48de7 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java
@@ -73,6 +73,38 @@ public class ChatPermissions implements BotApiObject {
return canPinMessages;
}
+ public void setCanSendMessages(Boolean canSendMessages) {
+ this.canSendMessages = canSendMessages;
+ }
+
+ public void setGetCanSendMediaMessages(Boolean getCanSendMediaMessages) {
+ this.getCanSendMediaMessages = getCanSendMediaMessages;
+ }
+
+ public void setCanSendPolls(Boolean canSendPolls) {
+ this.canSendPolls = canSendPolls;
+ }
+
+ public void setCanSendOtherMessages(Boolean canSendOtherMessages) {
+ this.canSendOtherMessages = canSendOtherMessages;
+ }
+
+ public void setCanAddWebPagePreviews(Boolean canAddWebPagePreviews) {
+ this.canAddWebPagePreviews = canAddWebPagePreviews;
+ }
+
+ public void setCanChangeInfo(Boolean canChangeInfo) {
+ this.canChangeInfo = canChangeInfo;
+ }
+
+ public void setCanInviteUsers(Boolean canInviteUsers) {
+ this.canInviteUsers = canInviteUsers;
+ }
+
+ public void setCanPinMessages(Boolean canPinMessages) {
+ this.canPinMessages = canPinMessages;
+ }
+
@Override
public String toString() {
return "ChatPermissions{" +
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiRequestException.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiRequestException.java
index 01d52b38..1dd7bcf7 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiRequestException.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiRequestException.java
@@ -18,9 +18,9 @@
package org.telegram.telegrambots.meta.exceptions;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.ResponseParameters;
@@ -33,7 +33,7 @@ import java.io.IOException;
* Exception thrown when something goes wrong in the api
*/
public class TelegramApiRequestException extends TelegramApiException {
- private static final Logger log = LogManager.getLogger(TelegramApiRequestException.class);
+ private static final Logger log = LoggerFactory.getLogger(TelegramApiRequestException.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final String ERRORDESCRIPTIONFIELD = "description";
@@ -56,7 +56,7 @@ public class TelegramApiRequestException extends TelegramApiException {
try {
parameters = OBJECT_MAPPER.readValue(object.getJSONObject(PARAMETERSFIELD).toString(), ResponseParameters.class);
} catch (IOException e) {
- log.fatal(e.getLocalizedMessage(), e);
+ log.error(e.getLocalizedMessage(), e);
}
}
}
diff --git a/telegrambots-meta/src/test/resources/log4j2-test.xml b/telegrambots-meta/src/test/resources/log4j2-test.xml
new file mode 100644
index 00000000..8054f7f7
--- /dev/null
+++ b/telegrambots-meta/src/test/resources/log4j2-test.xml
@@ -0,0 +1,19 @@
+
+
+
+ %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%t] %-5level %logger{36} - %msg%n
+ App
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index 565c59df..c2f57f5c 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.4.0
+ 4.4.0.2
telegrambots-spring-boot-starter
@@ -70,7 +70,8 @@
UTF-8
UTF-8
- 2.2.0.RELEASE
+
+ 2.2.1.RELEASE
@@ -78,7 +79,7 @@
org.telegram
telegrambots
- 4.4.0
+ 4.4.0.2
org.springframework.boot
@@ -103,7 +104,7 @@
org.assertj
assertj-core
test
- 3.13.1
+ 3.14.0
diff --git a/telegrambots-spring-boot-starter/src/main/java/org/telegram/telegrambots/starter/TelegramBotInitializer.java b/telegrambots-spring-boot-starter/src/main/java/org/telegram/telegrambots/starter/TelegramBotInitializer.java
index 951dc3b8..c0911641 100644
--- a/telegrambots-spring-boot-starter/src/main/java/org/telegram/telegrambots/starter/TelegramBotInitializer.java
+++ b/telegrambots-spring-boot-starter/src/main/java/org/telegram/telegrambots/starter/TelegramBotInitializer.java
@@ -1,7 +1,7 @@
package org.telegram.telegrambots.starter;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
@@ -21,7 +21,7 @@ import static java.lang.String.format;
* Receives all beand which are #LongPollingBot and #WebhookBot and register them in #TelegramBotsApi.
*/
public class TelegramBotInitializer implements InitializingBean {
- private static final Logger log = LogManager.getLogger(TelegramBotInitializer.class);
+ private static final Logger log = LoggerFactory.getLogger(TelegramBotInitializer.class);
private final TelegramBotsApi telegramBotsApi;
private final List longPollingBots;
diff --git a/telegrambots-spring-boot-starter/src/test/resources/log4j2-test.xml b/telegrambots-spring-boot-starter/src/test/resources/log4j2-test.xml
new file mode 100644
index 00000000..8054f7f7
--- /dev/null
+++ b/telegrambots-spring-boot-starter/src/test/resources/log4j2-test.xml
@@ -0,0 +1,19 @@
+
+
+
+ %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%t] %-5level %logger{36} - %msg%n
+ App
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index 1143fd5e..9ea6cb51 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.4.0
+ 4.4.0.2
telegrambots
@@ -70,12 +70,12 @@
UTF-8
UTF-8
- 2.29
+ 2.29.1
1.19.3
- 4.5.9
+ 4.5.10
20180813
- 2.9.9
- 2.9.9
+ 2.10.1
+ 2.10.1
2.6
@@ -95,7 +95,7 @@
org.telegram
telegrambots-meta
- 4.4.0
+ 4.4.0.2
com.fasterxml.jackson.core
@@ -105,12 +105,12 @@
com.fasterxml.jackson.jaxrs
jackson-jaxrs-json-provider
- ${jackson.version}
+ ${jacksonbase.version}
com.fasterxml.jackson.module
jackson-module-jaxb-annotations
- 2.9.9
+ 2.10.1
com.fasterxml.jackson.core
diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java
index b94d3a09..f6c522d3 100644
--- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java
+++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java
@@ -6,7 +6,6 @@ import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
@@ -16,7 +15,15 @@ import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder;
import org.telegram.telegrambots.facilities.filedownloader.TelegramFileDownloader;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.groupadministration.SetChatPhoto;
-import org.telegram.telegrambots.meta.api.methods.send.*;
+import org.telegram.telegrambots.meta.api.methods.send.SendAnimation;
+import org.telegram.telegrambots.meta.api.methods.send.SendAudio;
+import org.telegram.telegrambots.meta.api.methods.send.SendDocument;
+import org.telegram.telegrambots.meta.api.methods.send.SendMediaGroup;
+import org.telegram.telegrambots.meta.api.methods.send.SendPhoto;
+import org.telegram.telegrambots.meta.api.methods.send.SendSticker;
+import org.telegram.telegrambots.meta.api.methods.send.SendVideo;
+import org.telegram.telegrambots.meta.api.methods.send.SendVideoNote;
+import org.telegram.telegrambots.meta.api.methods.send.SendVoice;
import org.telegram.telegrambots.meta.api.methods.stickers.AddStickerToSet;
import org.telegram.telegrambots.meta.api.methods.stickers.CreateNewStickerSet;
import org.telegram.telegrambots.meta.api.methods.stickers.UploadStickerFile;
@@ -58,9 +65,9 @@ public abstract class DefaultAbsSender extends AbsSender {
protected final ExecutorService exe;
private final ObjectMapper objectMapper = new ObjectMapper();
private final DefaultBotOptions options;
- private volatile CloseableHttpClient httpClient;
- private volatile RequestConfig requestConfig;
- private final TelegramFileDownloader telegramFileDownloader = new TelegramFileDownloader(this::getBotToken);
+ private final CloseableHttpClient httpClient;
+ private final RequestConfig requestConfig;
+ private final TelegramFileDownloader telegramFileDownloader;
protected DefaultAbsSender(DefaultBotOptions options) {
super();
@@ -69,11 +76,14 @@ public abstract class DefaultAbsSender extends AbsSender {
this.options = options;
httpClient = TelegramHttpClientBuilder.build(options);
+ this.telegramFileDownloader = new TelegramFileDownloader(httpClient, this::getBotToken);
configureHttpContext();
- requestConfig = options.getRequestConfig();
- if (requestConfig == null) {
- requestConfig = RequestConfig.copy(RequestConfig.custom().build())
+ final RequestConfig configFromOptions = options.getRequestConfig();
+ if (configFromOptions != null) {
+ this.requestConfig = configFromOptions;
+ } else {
+ this.requestConfig = RequestConfig.copy(RequestConfig.custom().build())
.setSocketTimeout(SOCKET_TIMEOUT)
.setConnectTimeout(SOCKET_TIMEOUT)
.setConnectionRequestTimeout(SOCKET_TIMEOUT).build();
@@ -729,9 +739,7 @@ public abstract class DefaultAbsSender extends AbsSender {
private String sendHttpPostRequest(HttpPost httppost) throws IOException {
try (CloseableHttpResponse response = httpClient.execute(httppost, options.getHttpContext())) {
- HttpEntity ht = response.getEntity();
- BufferedHttpEntity buf = new BufferedHttpEntity(ht);
- return EntityUtils.toString(buf, StandardCharsets.UTF_8);
+ return EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
}
}
diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/facilities/TelegramHttpClientBuilder.java b/telegrambots/src/main/java/org/telegram/telegrambots/facilities/TelegramHttpClientBuilder.java
index 38a3a17a..3993fc79 100644
--- a/telegrambots/src/main/java/org/telegram/telegrambots/facilities/TelegramHttpClientBuilder.java
+++ b/telegrambots/src/main/java/org/telegram/telegrambots/facilities/TelegramHttpClientBuilder.java
@@ -45,7 +45,8 @@ public class TelegramHttpClientBuilder {
case SOCKS5:
registry = RegistryBuilder. create()
.register("http", new SocksConnectionSocketFactory())
- .register("https", new SocksSSLConnectionSocketFactory(SSLContexts.createSystemDefault())).build();
+ .register("https", new SocksSSLConnectionSocketFactory(SSLContexts.createSystemDefault()))
+ .build();
return new PoolingHttpClientConnectionManager(registry);
}
return null;
diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/DefaultBotSession.java b/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/DefaultBotSession.java
index 319e39ac..0f9f6334 100644
--- a/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/DefaultBotSession.java
+++ b/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/DefaultBotSession.java
@@ -2,25 +2,27 @@ package org.telegram.telegrambots.updatesreceivers;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
-import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.json.JSONException;
+import org.telegram.telegrambots.bots.DefaultBotOptions;
+import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.telegrambots.meta.ApiConstants;
import org.telegram.telegrambots.meta.api.methods.updates.GetUpdates;
import org.telegram.telegrambots.meta.api.objects.Update;
-import org.telegram.telegrambots.bots.DefaultBotOptions;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
-import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder;
-import org.telegram.telegrambots.meta.generics.*;
+import org.telegram.telegrambots.meta.generics.BotOptions;
+import org.telegram.telegrambots.meta.generics.BotSession;
+import org.telegram.telegrambots.meta.generics.LongPollingBot;
+import org.telegram.telegrambots.meta.generics.UpdatesHandler;
+import org.telegram.telegrambots.meta.generics.UpdatesReader;
import java.io.IOException;
import java.io.InvalidObjectException;
@@ -28,7 +30,11 @@ import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidParameterException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -40,7 +46,7 @@ import static org.telegram.telegrambots.Constants.SOCKET_TIMEOUT;
* Thread to request updates with active wait
*/
public class DefaultBotSession implements BotSession {
- private static final Logger log = LogManager.getLogger(DefaultBotSession.class);
+ private static final Logger log = LoggerFactory.getLogger(DefaultBotSession.class);
private AtomicBoolean running = new AtomicBoolean(false);
@@ -132,6 +138,7 @@ public class DefaultBotSession implements BotSession {
return running.get();
}
+ @SuppressWarnings("WeakerAccess")
private class ReaderThread extends Thread implements UpdatesReader {
private final UpdatesSupplier updatesSupplier;
@@ -207,7 +214,7 @@ public class DefaultBotSession implements BotSession {
log.debug(e.getLocalizedMessage(), e);
interrupt();
} catch (Exception global) {
- log.fatal(global.getLocalizedMessage(), global);
+ log.error(global.getLocalizedMessage(), global);
try {
synchronized (lock) {
lock.wait(exponentialBackOff.nextBackOffMillis());
@@ -244,9 +251,7 @@ public class DefaultBotSession implements BotSession {
httpPost.setEntity(new StringEntity(objectMapper.writeValueAsString(request), ContentType.APPLICATION_JSON));
try (CloseableHttpResponse response = httpclient.execute(httpPost, options.getHttpContext())) {
- HttpEntity ht = response.getEntity();
- BufferedHttpEntity buf = new BufferedHttpEntity(ht);
- String responseContent = EntityUtils.toString(buf, StandardCharsets.UTF_8);
+ String responseContent = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
if (response.getStatusLine().getStatusCode() >= 500) {
log.warn(responseContent);
@@ -263,7 +268,7 @@ public class DefaultBotSession implements BotSession {
}
}
} catch (SocketException | InvalidObjectException | TelegramApiRequestException e) {
- log.fatal(e.getLocalizedMessage(), e);
+ log.error(e.getLocalizedMessage(), e);
} catch (SocketTimeoutException e) {
log.info(e.getLocalizedMessage(), e);
} catch (InterruptedException e) {
@@ -309,7 +314,7 @@ public class DefaultBotSession implements BotSession {
log.debug(e.getLocalizedMessage(), e);
interrupt();
} catch (Exception e) {
- log.fatal(e.getLocalizedMessage(), e);
+ log.error(e.getLocalizedMessage(), e);
}
}
log.debug("Handler thread has being closed");
diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/RestApi.java b/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/RestApi.java
index 35fbc7f1..a6b4725f 100644
--- a/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/RestApi.java
+++ b/telegrambots/src/main/java/org/telegram/telegrambots/updatesreceivers/RestApi.java
@@ -1,7 +1,7 @@
package org.telegram.telegrambots.updatesreceivers;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
@Path("callback")
public class RestApi {
- private static final Logger log = LogManager.getLogger(RestApi.class);
+ private static final Logger log = LoggerFactory.getLogger(RestApi.class);
private final ConcurrentHashMap callbacks = new ConcurrentHashMap<>();
diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java b/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java
index a294738d..5210cd6c 100644
--- a/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java
+++ b/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java
@@ -1,9 +1,9 @@
package org.telegram.telegrambots.util;
import org.apache.http.HttpEntity;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -11,19 +11,21 @@ import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import org.telegram.telegrambots.meta.ApiConstants;
-import org.telegram.telegrambots.meta.api.methods.updates.DeleteWebhook;
import org.telegram.telegrambots.bots.DefaultAbsSender;
import org.telegram.telegrambots.bots.DefaultBotOptions;
-import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder;
+import org.telegram.telegrambots.meta.ApiConstants;
+import org.telegram.telegrambots.meta.api.methods.updates.DeleteWebhook;
import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook;
+import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import static org.telegram.telegrambots.Constants.SOCKET_TIMEOUT;
+
public final class WebhookUtils {
private WebhookUtils() {
@@ -35,8 +37,16 @@ public final class WebhookUtils {
try (CloseableHttpClient httpclient = TelegramHttpClientBuilder.build(botOptions)) {
String requestUrl = bot.getBaseUrl() + SetWebhook.PATH;
+ RequestConfig requestConfig = botOptions.getRequestConfig();
+ if (requestConfig == null) {
+ requestConfig = RequestConfig.copy(RequestConfig.custom().build())
+ .setSocketTimeout(SOCKET_TIMEOUT)
+ .setConnectTimeout(SOCKET_TIMEOUT)
+ .setConnectionRequestTimeout(SOCKET_TIMEOUT).build();
+ }
+
HttpPost httppost = new HttpPost(requestUrl);
- httppost.setConfig(botOptions.getRequestConfig());
+ httppost.setConfig(requestConfig);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SetWebhook.URL_FIELD, url);
if (botOptions.getMaxWebhookConnections() != null) {
@@ -54,9 +64,7 @@ public final class WebhookUtils {
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
try (CloseableHttpResponse response = httpclient.execute(httppost, botOptions.getHttpContext())) {
- HttpEntity ht = response.getEntity();
- BufferedHttpEntity buf = new BufferedHttpEntity(ht);
- String responseContent = EntityUtils.toString(buf, StandardCharsets.UTF_8);
+ String responseContent = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
JSONObject jsonObject = new JSONObject(responseContent);
if (!jsonObject.getBoolean(ApiConstants.RESPONSE_FIELD_OK)) {
throw new TelegramApiRequestException("Error setting webhook", jsonObject);
diff --git a/telegrambots/src/test/resources/log4j2-test.xml b/telegrambots/src/test/resources/log4j2-test.xml
new file mode 100644
index 00000000..8054f7f7
--- /dev/null
+++ b/telegrambots/src/test/resources/log4j2-test.xml
@@ -0,0 +1,19 @@
+
+
+
+ %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%t] %-5level %logger{36} - %msg%n
+ App
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file