1
1
mirror of https://github.com/ahabhyde/miguelbridge synced 2025-01-25 05:24:19 +01:00

Aggiunto comando info

This commit is contained in:
Ahab Hyde 2018-04-16 17:33:40 +02:00
parent 61e32deef6
commit c240c697dd

View File

@ -42,6 +42,12 @@ public class TGBot extends TelegramLongPollingBot {
String chat_id = "" + update.getMessage().getChatId();
cEcho(chat_id, chat_id);
}
else if (update.getMessage().getText().equalsIgnoreCase("/info") ||
update.getMessage().getText().equalsIgnoreCase("/info@" + getBotUsername())) {
String chat_id = "" + update.getMessage().getChatId();
cInfo(chat_id);
}
else {
//Testo e mittente
String testoMessaggio = update.getMessage().getText();
@ -104,7 +110,7 @@ public class TGBot extends TelegramLongPollingBot {
messaggio = new SendMessage()
.setChatId(chat_id)
.setText(testoMessaggio);
try {
//Invia il messaggio all'utente
sendMessage(messaggio);
@ -113,6 +119,12 @@ public class TGBot extends TelegramLongPollingBot {
}
}
public void cInfo(String chat_id){
String stringa = "Bot utilizzato per il bridge tra Telegram e Matrix.\n" +
"Per informazioni: https://github.com/AhabHyde/MiguelBridge";
cEcho(chat_id, stringa);
}
private void echoToMatrix(String testoMessaggio, String sender, String destination) {
try {
matrixBot.sendMessage(sender + ":\n" + testoMessaggio, destination);