Merge pull request #69 from rubenlagus/dev

Dev
This commit is contained in:
Ruben Bermudez 2016-05-05 23:28:48 +02:00
commit f8396f758d
4 changed files with 37 additions and 10 deletions

View File

@ -1,4 +1,6 @@
# Telegram Bot Java Library
[![Telegram](http://trellobot.doomdns.org/telegrambadge.svg)](https://telegram.me/JavaBotsApi)
A simple to use library to create Telegram Bots in Java
## Contributions
@ -13,7 +15,7 @@ I recommend using getUpdates methods.
## Usage
Just import add the library to your project using [Maven, Gradly, ...](https://jitpack.io/#rubenlagus/TelegramBots/v2.3) or download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v2.3)
Just import add the library to your project using [Maven, Gradly, ...](https://jitpack.io/#rubenlagus/TelegramBots/v2.3.1) or download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v2.3.1)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

24
badge.svg Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="a">
<rect width="100" height="20" rx="3" fill="#fff"/>
</mask>
<g mask="url(#a)">
<path fill="#555" d="M0 0h34v20H0z"/>
<path fill="#54a9eb" d="M34 0h68v20H34z"/>
<path fill="url(#b)" d="M0 0h92v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle"
font-family="HelveticaNeue-Light,Helvetica Neue Light, Helvetica Light,Helvetica,Arial,Verdana,sans-serif"
font-size="11" color="#fff" font-weight="bold">
<text x="16" y="15" fill="#010101" fill-opacity=".3">chat</text>
<text x="16" y="14">chat</text>
<text x="67" y="15" fill="#010101" fill-opacity=".3">on telegram</text>
<text x="67" y="14">on telegram</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1012 B

View File

@ -6,7 +6,7 @@
<packaging>jar</packaging>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>2.3</version>
<version>2.3.1</version>
<name>Telegram Bots</name>
<url>https://telegram.me/JavaBotsApi</url>

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -39,9 +40,9 @@ public class InlineQueryResultLocation implements InlineQueryResult {
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Location title
@JsonProperty(LATITUDE_FIELD)
private String latitude; ///< Location latitude in degrees
private Float latitude; ///< Location latitude in degrees
@JsonProperty(LONGITUDE_FIELD)
private String longitude; ///< Location longitude in degrees
private Float longitude; ///< Location longitude in degrees
@JsonProperty(REPLY_MARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message
@JsonProperty(INPUTMESSAGECONTENT_FIELD)
@ -75,20 +76,20 @@ public class InlineQueryResultLocation implements InlineQueryResult {
return this;
}
public String getLatitude() {
public Float getLatitude() {
return latitude;
}
public InlineQueryResultLocation setLatitude(String latitude) {
public InlineQueryResultLocation setLatitude(Float latitude) {
this.latitude = latitude;
return this;
}
public String getLongitude() {
public Float getLongitude() {
return longitude;
}
public InlineQueryResultLocation setLongitude(String longitude) {
public InlineQueryResultLocation setLongitude(Float longitude) {
this.longitude = longitude;
return this;
}
@ -169,8 +170,8 @@ public class InlineQueryResultLocation implements InlineQueryResult {
gen.writeStartObject();
gen.writeStringField(TYPE_FIELD, type);
gen.writeStringField(ID_FIELD, id);
gen.writeStringField(LONGITUDE_FIELD, longitude);
gen.writeStringField(LATITUDE_FIELD, latitude);
gen.writeNumberField(LONGITUDE_FIELD, longitude);
gen.writeNumberField(LATITUDE_FIELD, latitude);
gen.writeStringField(TITLE_FIELD, title);
if (replyMarkup != null) {
gen.writeObjectField(REPLY_MARKUP_FIELD, replyMarkup);