org.apache.commons
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 ef74a500..c7e6118d 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
@@ -107,7 +107,7 @@ import static org.telegram.abilitybots.api.util.AbilityUtils.isUserMessage;
*
* @author Abbas Abou Daya
*/
-@SuppressWarnings({"ConfusingArgumentToVarargsMethod", "UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"})
+@SuppressWarnings({"UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"})
public abstract class BaseAbilityBot extends DefaultAbsSender implements AbilityExtension {
private static final Logger log = LoggerFactory.getLogger(BaseAbilityBot.class);
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java
index 8b2303b5..37fd8fc7 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java
@@ -3,7 +3,7 @@ package org.telegram.abilitybots.api.objects;
import org.telegram.abilitybots.api.objects.Ability.AbilityBuilder;
import org.telegram.telegrambots.meta.api.objects.Update;
-import java.util.function.Consumer;
+import java.util.function.BiConsumer;
import java.util.function.Predicate;
import static java.util.Objects.nonNull;
@@ -11,7 +11,7 @@ import static java.util.Objects.nonNull;
/**
* Flags are an conditions that are applied on an {@link Update}.
*
- * They can be used on {@link AbilityBuilder#flag(Predicate[])} and on the post conditions in {@link AbilityBuilder#reply(Consumer, Predicate[])}.
+ * They can be used on {@link AbilityBuilder#flag(Predicate[])} and on the post conditions in {@link AbilityBuilder#reply(BiConsumer, Predicate[])}.
*
* @author Abbas Abou Daya
*/
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Reply.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Reply.java
index 8ba939ab..3cbb47d0 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Reply.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Reply.java
@@ -9,7 +9,6 @@ import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
-import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -18,7 +17,7 @@ import static com.google.common.collect.Lists.newArrayList;
/**
* A reply consists of update conditionals and an action to be applied on the update.
*
- * If an update satisfies the {@link Reply#conditions} set by the reply, then it's safe to {@link Reply#actOn(Update)}.
+ * If an update satisfies the {@link Reply#conditions} set by the reply, then it's safe to {@link Reply#actOn(BaseAbilityBot, Update)}.
*
* @author Abbas Abou Daya
*/
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/ReplyFlow.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/ReplyFlow.java
index d2148464..8eeda9e4 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/ReplyFlow.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/ReplyFlow.java
@@ -12,7 +12,6 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
-import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/MessageSender.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/MessageSender.java
index 95a049e5..b3ba74bc 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/MessageSender.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/MessageSender.java
@@ -30,9 +30,9 @@ public interface MessageSender {
Boolean addStickerToSet(AddStickerToSet addStickerToSet) throws TelegramApiException;
- public Boolean createNewStickerSet(CreateNewStickerSet createNewStickerSet) throws TelegramApiException;
+ Boolean createNewStickerSet(CreateNewStickerSet createNewStickerSet) throws TelegramApiException;
- public File uploadStickerFile(UploadStickerFile uploadStickerFile) throws TelegramApiException;
+ File uploadStickerFile(UploadStickerFile uploadStickerFile) throws TelegramApiException;
Boolean setChatPhoto(SetChatPhoto setChatPhoto) throws TelegramApiException;
diff --git a/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/sender/SilentSenderTest.java b/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/sender/SilentSenderTest.java
index 884cf72d..219fbea4 100644
--- a/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/sender/SilentSenderTest.java
+++ b/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/sender/SilentSenderTest.java
@@ -14,7 +14,10 @@ import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
class SilentSenderTest {
private SilentSender silent;
@@ -55,7 +58,7 @@ class SilentSenderTest {
verify(sender, only()).executeAsync(methodObject, callback);
}
- private class NoOpCallback implements SentCallback {
+ private static class NoOpCallback implements SentCallback {
@Override
public void onResult(BotApiMethod method, Message response) {
@@ -72,6 +75,4 @@ class SilentSenderTest {
}
}
-
- ;
}
\ No newline at end of file
diff --git a/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/toggle/CustomToggleTest.java b/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/toggle/CustomToggleTest.java
index e2b131f3..5ae9a0d1 100644
--- a/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/toggle/CustomToggleTest.java
+++ b/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/toggle/CustomToggleTest.java
@@ -7,12 +7,14 @@ import org.telegram.abilitybots.api.bot.DefaultAbilities;
import org.telegram.abilitybots.api.bot.DefaultBot;
import org.telegram.abilitybots.api.db.DBContext;
-import java.io.FileInputStream;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.Properties;
import static org.apache.commons.lang3.StringUtils.EMPTY;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.telegram.abilitybots.api.db.MapDBContext.offlineInstance;
class CustomToggleTest {
@@ -55,7 +57,7 @@ class CustomToggleTest {
public void canTurnOffAbilitiesThroughProperties() {
Properties properties = new Properties();
try {
- properties.load(new FileInputStream(filename));
+ properties.load(Files.newInputStream(Paths.get(filename)));
toggle = new CustomToggle().config(properties);
} catch (IOException e) {
System.out.println("No such file");
@@ -71,7 +73,7 @@ class CustomToggleTest {
public void canProcessAbilitiesThroughProperties() {
Properties properties = new Properties();
try {
- properties.load(new FileInputStream(filename));
+ properties.load(Files.newInputStream(Paths.get(filename)));
toggle = new CustomToggle().config(properties);
} catch (IOException e) {
System.out.println("No such file");
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index debf98e8..db497f32 100644
--- a/telegrambots-chat-session-bot/README.md
+++ b/telegrambots-chat-session-bot/README.md
@@ -15,14 +15,14 @@ Usage
org.telegram
telegrambots-chat-session-bot
- 6.5.0
+ 6.8.0
```
**Gradle**
```gradle
- implementation 'org.telegram:telegrambots-chat-session-bot:6.5.0'
+ implementation 'org.telegram:telegrambots-chat-session-bot:6.8.0'
```
Motivation
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index 1c5641b8..b9840120 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -7,7 +7,7 @@
org.warp
bots
- 6.5.0
+ 6.8.0
telegrambots-chat-session-bot
@@ -86,7 +86,7 @@
org.warp
telegrambots
- 6.5.0
+ 6.8.0
diff --git a/telegrambots-chat-session-bot/src/main/java/org/telegram/telegrambots/session/DefaultChatIdConverter.java b/telegrambots-chat-session-bot/src/main/java/org/telegram/telegrambots/session/DefaultChatIdConverter.java
index 5e5dd571..726ab4ff 100644
--- a/telegrambots-chat-session-bot/src/main/java/org/telegram/telegrambots/session/DefaultChatIdConverter.java
+++ b/telegrambots-chat-session-bot/src/main/java/org/telegram/telegrambots/session/DefaultChatIdConverter.java
@@ -20,7 +20,7 @@ public class DefaultChatIdConverter implements ChatIdConverter {
@Override
public void setSessionId(Serializable sessionId){
this.sessionId = (long) sessionId;
- };
+ }
@Override
public Serializable getSessionId() {
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index 3c3a33a2..3cdcae43 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
- 6.5.0
+ 6.8.0
```
2. Using Gradle:
```gradle
- implementation 'org.telegram:telegrambotsextensions:6.5.0'
+ implementation 'org.telegram:telegrambotsextensions:6.8.0'
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index bfcb5360..6e587693 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -7,7 +7,7 @@
org.warp
bots
- 6.5.0
+ 6.8.0
telegrambotsextensions
@@ -77,7 +77,7 @@
org.warp
telegrambots
- 6.5.0
+ 6.8.0
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 d55a4fe4..d3644316 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
@@ -26,7 +26,9 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* Creates a TelegramLongPollingCommandBot using default options
* Use ICommandRegistry's methods on this bot to register commands
*
+ * @deprecated Use {{@link #TelegramLongPollingBot(String)}
*/
+ @Deprecated
public TelegramLongPollingCommandBot() {
this(new DefaultBotOptions());
}
@@ -37,7 +39,10 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* Use ICommandRegistry's methods on this bot to register commands
*
* @param options Bot options
+ *
+ * @deprecated Use {{@link #TelegramLongPollingBot(DefaultBotOptions, String)}
*/
+ @Deprecated
public TelegramLongPollingCommandBot(DefaultBotOptions options) {
this(options, true);
}
@@ -49,12 +54,48 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* @param options Bot options
* @param allowCommandsWithUsername true to allow commands with parameters (default),
* false otherwise
+ *
+ * @deprecated Use {{@link #TelegramLongPollingBot(DefaultBotOptions, boolean, String)}
*/
+ @Deprecated
public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername) {
super(options);
this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this::getBotUsername);
}
+ /**
+ * Creates a TelegramLongPollingCommandBot using default options
+ * Use ICommandRegistry's methods on this bot to register commands
+ *
+ */
+ public TelegramLongPollingCommandBot(String botToken) {
+ this(new DefaultBotOptions(), botToken);
+ }
+
+ /**
+ * Creates a TelegramLongPollingCommandBot with custom options and allowing commands with
+ * usernames
+ * Use ICommandRegistry's methods on this bot to register commands
+ *
+ * @param options Bot options
+ */
+ public TelegramLongPollingCommandBot(DefaultBotOptions options, String botToken) {
+ this(options, true, botToken);
+ }
+
+ /**
+ * Creates a TelegramLongPollingCommandBot
+ * Use ICommandRegistry's methods on this bot to register commands
+ *
+ * @param options Bot options
+ * @param allowCommandsWithUsername true to allow commands with parameters (default),
+ * false otherwise
+ */
+ public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername, String botToken) {
+ super(options, botToken);
+ this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this::getBotUsername);
+ }
+
@Override
public final void onUpdateReceived(Update update) {
if (update.hasMessage()) {
diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java
index cddf610a..a2f0bc81 100644
--- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java
+++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java
@@ -42,7 +42,7 @@ public class HelpCommand extends ManCommand {
* @return a formatted String containing command and description for all supplied commands
*/
public static String getHelpText(Collection botCommands) {
- return getHelpText(botCommands.toArray(new IBotCommand[botCommands.size()]));
+ return getHelpText(botCommands.toArray(new IBotCommand[0]));
}
/**
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index 7e831097..1ba6d436 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -7,7 +7,7 @@
org.warp
bots
- 6.5.0
+ 6.8.0
telegrambots-meta
@@ -97,6 +97,13 @@
lombok
provided
+
+