Skip to content

Instantly share code, notes, and snippets.

@rubenlagus
rubenlagus / Orde
Created September 22, 2014 15:12
Orden
if (tl_dialog.unread_count > 0 && tl_dialog2.unread_count <= 0) {
return -1;
}
else if (tl_dialog.unread_count <= 0 && tl_dialog2.unread_count > 0) {
return 1;
}
else {
if (tl_dialog.last_message_date == tl_dialog2.last_message_date) {
return 0;
} else if (tl_dialog.last_message_date < tl_dialog2.last_message_date) {
@rubenlagus
rubenlagus / Main.java
Last active May 31, 2021 13:22
Example of sending a SendMessage method using Telegram API with ReplyMarkupKeyboard
package org.telegram.example.SendMessage;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
@rubenlagus
rubenlagus / echobot.java
Created February 3, 2016 19:26
Echo bot
package org.telegram.updateshandlers;
import org.telegram.services.BotLogger;
import org.telegram.telegrambots.TelegramApiException;
import org.telegram.telegrambots.api.methods.SendMessage;
import org.telegram.telegrambots.api.objects.Message;
import org.telegram.telegrambots.api.objects.Update;
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
public class EchoHandlers extends TelegramLongPollingBot {

Telegram bot redesign

Licensing

MIT

Versioning

major.minor.patch

The first three correspont to the major and minor version of the bot api. The patch version van be used for interim library released for hotfixes or adding features. This decouples the library release cycle from the telegram release cycle