Added support for cancelling certain Telegram events
This commit is contained in:
parent
06923bec46
commit
2a4273afe1
@ -140,9 +140,9 @@ public class Telegram {
|
||||
actionListener.onSendToTelegram(chat);
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
|
||||
if(!chat.isCancelled()){
|
||||
post("sendMessage", gson.toJson(chat, ChatMessageToTelegram.class));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendAll(final ChatMessageToTelegram chat) {
|
||||
|
@ -0,0 +1,13 @@
|
||||
package de.Linus122.TelegramComponents;
|
||||
|
||||
public class Cancellable {
|
||||
private boolean isCancelled = false;
|
||||
|
||||
public boolean isCancelled() {
|
||||
return isCancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean isCancelled) {
|
||||
this.isCancelled = isCancelled;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package de.Linus122.TelegramComponents;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatMessageToMc {
|
||||
public class ChatMessageToMc extends Cancellable{
|
||||
UUID uuid_sender;
|
||||
String content;
|
||||
int chatID_sender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.Linus122.TelegramComponents;
|
||||
|
||||
public class ChatMessageToTelegram {
|
||||
public class ChatMessageToTelegram extends Cancellable{
|
||||
public String text;
|
||||
public int chat_id;
|
||||
public String parse_mode;
|
||||
|
Loading…
Reference in New Issue
Block a user