diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityBot.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityBot.java index 9a0af3d3..de3016e1 100644 --- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityBot.java +++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityBot.java @@ -1,11 +1,11 @@ package org.telegram.abilitybots.api.bot; import org.telegram.abilitybots.api.db.DBContext; -import org.telegram.telegrambots.api.objects.Update; +import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.bots.DefaultBotOptions; import org.telegram.telegrambots.bots.TelegramLongPollingBot; -import org.telegram.telegrambots.exceptions.TelegramApiRequestException; -import org.telegram.telegrambots.generics.LongPollingBot; +import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; +import org.telegram.telegrambots.meta.generics.LongPollingBot; import org.telegram.telegrambots.util.WebhookUtils; import static org.telegram.abilitybots.api.db.MapDBContext.onlineInstance; diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityWebhookBot.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityWebhookBot.java index 115e7dbb..04887d7c 100644 --- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityWebhookBot.java +++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityWebhookBot.java @@ -1,12 +1,12 @@ package org.telegram.abilitybots.api.bot; import org.telegram.abilitybots.api.db.DBContext; -import org.telegram.telegrambots.api.methods.BotApiMethod; -import org.telegram.telegrambots.api.objects.Update; +import org.telegram.telegrambots.meta.api.methods.BotApiMethod; +import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.bots.DefaultBotOptions; import org.telegram.telegrambots.bots.TelegramWebhookBot; -import org.telegram.telegrambots.exceptions.TelegramApiRequestException; -import org.telegram.telegrambots.generics.WebhookBot; +import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; +import org.telegram.telegrambots.meta.generics.WebhookBot; import org.telegram.telegrambots.util.WebhookUtils; import static org.telegram.abilitybots.api.db.MapDBContext.onlineInstance; @@ -16,6 +16,7 @@ import static org.telegram.abilitybots.api.db.MapDBContext.onlineInstance; * * @author Abbas Abou Daya */ +@SuppressWarnings("WeakerAccess") public abstract class AbilityWebhookBot extends BaseAbilityBot implements WebhookBot { private final String botPath; 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 65ebcae0..aab22a2e 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 @@ -15,17 +15,17 @@ import org.telegram.abilitybots.api.sender.SilentSender; import org.telegram.abilitybots.api.util.AbilityUtils; import org.telegram.abilitybots.api.util.Pair; import org.telegram.abilitybots.api.util.Trio; -import org.telegram.telegrambots.api.methods.GetFile; -import org.telegram.telegrambots.api.methods.groupadministration.GetChatAdministrators; -import org.telegram.telegrambots.api.methods.send.SendDocument; -import org.telegram.telegrambots.api.objects.Message; -import org.telegram.telegrambots.api.objects.Update; -import org.telegram.telegrambots.api.objects.User; +import org.telegram.telegrambots.meta.api.methods.GetFile; +import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChatAdministrators; +import org.telegram.telegrambots.meta.api.methods.send.SendDocument; +import org.telegram.telegrambots.meta.api.objects.Message; +import org.telegram.telegrambots.meta.api.objects.User; import org.telegram.telegrambots.bots.DefaultAbsSender; import org.telegram.telegrambots.bots.DefaultBotOptions; import org.telegram.telegrambots.bots.TelegramLongPollingBot; -import org.telegram.telegrambots.exceptions.TelegramApiException; -import org.telegram.telegrambots.logging.BotLogger; +import org.telegram.telegrambots.meta.exceptions.TelegramApiException; +import org.telegram.telegrambots.meta.logging.BotLogger; +import org.telegram.telegrambots.meta.api.objects.Update; import java.io.File; import java.io.FileNotFoundException; @@ -52,7 +52,6 @@ import static java.util.regex.Pattern.compile; import static java.util.stream.Collectors.joining; import static jersey.repackaged.com.google.common.base.Throwables.propagate; import static org.apache.commons.lang3.StringUtils.isEmpty; -import static org.telegram.abilitybots.api.db.MapDBContext.onlineInstance; import static org.telegram.abilitybots.api.objects.Ability.builder; import static org.telegram.abilitybots.api.objects.Flag.*; import static org.telegram.abilitybots.api.objects.Locality.*; @@ -93,6 +92,7 @@ import static org.telegram.abilitybots.api.util.AbilityUtils.*; * * @author Abbas Abou Daya */ +@SuppressWarnings({"ConfusingArgumentToVarargsMethod", "UnusedReturnValue", "WeakerAccess", "unused", "ConstantConditions"}) public abstract class BaseAbilityBot extends DefaultAbsSender { private static final String TAG = BaseAbilityBot.class.getSimpleName(); @@ -399,7 +399,7 @@ public abstract class BaseAbilityBot extends DefaultAbsSender { try (PrintStream printStream = new PrintStream(backup)) { printStream.print(db.backup()); sender.sendDocument(new SendDocument() - .setNewDocument(backup) + .setDocument(backup) .setChatId(ctx.chatId()) ); } catch (FileNotFoundException e) { 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 1d31e80f..502ca1d8 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 @@ -29,7 +29,7 @@ import static org.telegram.abilitybots.api.bot.BaseAbilityBot.USERS; * @author Abbas Abou Daya * @see MapDB project */ -@SuppressWarnings("unchecked") +@SuppressWarnings({"unchecked", "WeakerAccess"}) public class MapDBContext implements DBContext { private static final String TAG = DBContext.class.getSimpleName(); @@ -169,7 +169,7 @@ public class MapDBContext implements DBContext { } @Override - public void close() throws IOException { + public void close() { db.close(); } diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java b/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java index 5a6a59d7..9b2c2855 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java @@ -1,10 +1,9 @@ package org.telegram.telegrambots.bots; import org.telegram.telegrambots.meta.ApiContext; -import org.telegram.telegrambots.meta.api.methods.updates.DeleteWebhook; -import org.telegram.telegrambots.meta.exceptions.TelegramApiException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.generics.LongPollingBot; +import org.telegram.telegrambots.util.WebhookUtils; /** * @author Ruben Bermudez diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramWebhookBot.java b/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramWebhookBot.java index f37cafe5..05032668 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramWebhookBot.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramWebhookBot.java @@ -1,34 +1,17 @@ package org.telegram.telegrambots.bots; -import org.apache.http.HttpEntity; -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; -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.ApiContext; -import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; -import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder; import org.telegram.telegrambots.meta.generics.WebhookBot; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; +import org.telegram.telegrambots.util.WebhookUtils; /** * @author Ruben Bermudez * @version 1.0 - * @brief Base abstract class for a bot that will receive updates using a + * Base abstract class for a bot that will receive updates using a * webhook - * @date 14 of January of 2016 */ +@SuppressWarnings("WeakerAccess") public abstract class TelegramWebhookBot extends DefaultAbsSender implements WebhookBot { public TelegramWebhookBot() { this(ApiContext.getInstance(DefaultBotOptions.class)); 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 fbf2115c..9d59fc7a 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java @@ -11,14 +11,14 @@ import org.apache.http.util.EntityUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import org.telegram.telegrambots.ApiConstants; -import org.telegram.telegrambots.api.methods.updates.DeleteWebhook; -import org.telegram.telegrambots.api.methods.updates.SetWebhook; +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.exceptions.TelegramApiException; -import org.telegram.telegrambots.exceptions.TelegramApiRequestException; +import org.telegram.telegrambots.meta.exceptions.TelegramApiException; import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder; +import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook; +import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import java.io.File; import java.io.IOException;