Skip to content

Commit c0b0c2d

Browse files
committed
All send* methods take chat_id as Long type
1 parent 6885f6d commit c0b0c2d

File tree

3 files changed

+72
-101
lines changed

3 files changed

+72
-101
lines changed

src/main/java/com/pengrad/telegrambot/TelegramBot.java

Lines changed: 45 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Stas Parshin
1111
* 16 October 2015
1212
*/
13-
public class TelegramBot implements BotApi {
13+
public class TelegramBot {
1414

1515
private final BotApi botApi;
1616
private final FileApi fileApi;
@@ -32,148 +32,118 @@ public String getFullFilePath(File file) {
3232
return fileApi.getFullFilePath(file.filePath());
3333
}
3434

35-
@Override
3635
public GetMeResponse getMe() {
3736
return botApi.getMe();
3837
}
3938

40-
@Override
41-
//TODO: change chatId to Long, as in Chat object
42-
public SendResponse sendMessage(Integer chatId, String text, ParseMode parse_mode, Boolean disableWebPagePreview, Integer replyToMessageId, Keyboard replyMarkup) {
43-
return botApi.sendMessage(chatId, text, parse_mode, disableWebPagePreview, replyToMessageId, replyMarkup);
39+
public SendResponse sendMessage(Long chatId, String text, ParseMode parse_mode, Boolean disableWebPagePreview, Integer replyToMessageId, Keyboard replyMarkup) {
40+
return botApi.sendMessage(String.valueOf(chatId), text, parse_mode, disableWebPagePreview, replyToMessageId, replyMarkup);
4441
}
4542

46-
@Override
47-
public SendResponse forwardMessage(Integer chatId, Integer fromChatId, Integer messageId) {
48-
return botApi.forwardMessage(chatId, fromChatId, messageId);
43+
public SendResponse forwardMessage(Long chatId, Long fromChatId, Integer messageId) {
44+
return botApi.forwardMessage(String.valueOf(chatId), String.valueOf(fromChatId), messageId);
4945
}
5046

51-
@Override
52-
public SendResponse sendPhoto(Integer chatId, String photo, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
53-
return botApi.sendPhoto(chatId, photo, caption, replyToMessageId, replyMarkup);
47+
public SendResponse sendPhoto(Long chatId, String photo, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
48+
return botApi.sendPhoto(String.valueOf(chatId), photo, caption, replyToMessageId, replyMarkup);
5449
}
5550

56-
@Override
57-
public SendResponse sendPhoto(Integer chatId, InputFile photo, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
58-
return botApi.sendPhoto(chatId, photo, caption, replyToMessageId, replyMarkup);
51+
public SendResponse sendPhoto(Long chatId, InputFile photo, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
52+
return botApi.sendPhoto(String.valueOf(chatId), photo, caption, replyToMessageId, replyMarkup);
5953
}
6054

61-
@Override
62-
public SendResponse sendPhoto(Integer chatId, InputFileBytes photo, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
63-
return botApi.sendPhoto(chatId, photo, caption, replyToMessageId, replyMarkup);
55+
public SendResponse sendPhoto(Long chatId, InputFileBytes photo, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
56+
return botApi.sendPhoto(String.valueOf(chatId), photo, caption, replyToMessageId, replyMarkup);
6457
}
6558

66-
@Override
67-
public SendResponse sendAudio(Integer chatId, String audio, Integer duration, String performer, String title, Integer replyToMessageId, Keyboard replyMarkup) {
68-
return botApi.sendAudio(chatId, audio, duration, performer, title, replyToMessageId, replyMarkup);
59+
public SendResponse sendAudio(Long chatId, String audio, Integer duration, String performer, String title, Integer replyToMessageId, Keyboard replyMarkup) {
60+
return botApi.sendAudio(String.valueOf(chatId), audio, duration, performer, title, replyToMessageId, replyMarkup);
6961
}
7062

71-
@Override
72-
public SendResponse sendAudio(Integer chatId, InputFile audio, Integer duration, String performer, String title, Integer replyToMessageId, Keyboard replyMarkup) {
73-
return botApi.sendAudio(chatId, audio, duration, performer, title, replyToMessageId, replyMarkup);
63+
public SendResponse sendAudio(Long chatId, InputFile audio, Integer duration, String performer, String title, Integer replyToMessageId, Keyboard replyMarkup) {
64+
return botApi.sendAudio(String.valueOf(chatId), audio, duration, performer, title, replyToMessageId, replyMarkup);
7465
}
7566

76-
@Override
77-
public SendResponse sendAudio(Integer chatId, InputFileBytes audio, Integer duration, String performer, String title, Integer replyToMessageId, Keyboard replyMarkup) {
78-
return botApi.sendAudio(chatId, audio, duration, performer, title, replyToMessageId, replyMarkup);
67+
public SendResponse sendAudio(Long chatId, InputFileBytes audio, Integer duration, String performer, String title, Integer replyToMessageId, Keyboard replyMarkup) {
68+
return botApi.sendAudio(String.valueOf(chatId), audio, duration, performer, title, replyToMessageId, replyMarkup);
7969
}
8070

81-
@Override
82-
public SendResponse sendDocument(Integer chatId, String document, Integer replyToMessageId, Keyboard replyMarkup) {
83-
return botApi.sendDocument(chatId, document, replyToMessageId, replyMarkup);
71+
public SendResponse sendDocument(Long chatId, String document, Integer replyToMessageId, Keyboard replyMarkup) {
72+
return botApi.sendDocument(String.valueOf(chatId), document, replyToMessageId, replyMarkup);
8473
}
8574

86-
@Override
87-
public SendResponse sendDocument(Integer chatId, InputFile document, Integer replyToMessageId, Keyboard replyMarkup) {
88-
return botApi.sendDocument(chatId, document, replyToMessageId, replyMarkup);
75+
public SendResponse sendDocument(Long chatId, InputFile document, Integer replyToMessageId, Keyboard replyMarkup) {
76+
return botApi.sendDocument(String.valueOf(chatId), document, replyToMessageId, replyMarkup);
8977
}
9078

91-
@Override
92-
public SendResponse sendDocument(Integer chatId, InputFileBytes document, Integer replyToMessageId, Keyboard replyMarkup) {
93-
return botApi.sendDocument(chatId, document, replyToMessageId, replyMarkup);
79+
public SendResponse sendDocument(Long chatId, InputFileBytes document, Integer replyToMessageId, Keyboard replyMarkup) {
80+
return botApi.sendDocument(String.valueOf(chatId), document, replyToMessageId, replyMarkup);
9481
}
9582

96-
@Override
97-
public SendResponse sendSticker(Integer chatId, String sticker, Integer replyToMessageId, Keyboard replyMarkup) {
98-
return botApi.sendSticker(chatId, sticker, replyToMessageId, replyMarkup);
83+
public SendResponse sendSticker(Long chatId, String sticker, Integer replyToMessageId, Keyboard replyMarkup) {
84+
return botApi.sendSticker(String.valueOf(chatId), sticker, replyToMessageId, replyMarkup);
9985
}
10086

101-
@Override
102-
public SendResponse sendSticker(Integer chatId, InputFile sticker, Integer replyToMessageId, Keyboard replyMarkup) {
103-
return botApi.sendSticker(chatId, sticker, replyToMessageId, replyMarkup);
87+
public SendResponse sendSticker(Long chatId, InputFile sticker, Integer replyToMessageId, Keyboard replyMarkup) {
88+
return botApi.sendSticker(String.valueOf(chatId), sticker, replyToMessageId, replyMarkup);
10489
}
10590

106-
@Override
107-
public SendResponse sendSticker(Integer chatId, InputFileBytes sticker, Integer replyToMessageId, Keyboard replyMarkup) {
108-
return botApi.sendSticker(chatId, sticker, replyToMessageId, replyMarkup);
91+
public SendResponse sendSticker(Long chatId, InputFileBytes sticker, Integer replyToMessageId, Keyboard replyMarkup) {
92+
return botApi.sendSticker(String.valueOf(chatId), sticker, replyToMessageId, replyMarkup);
10993
}
11094

111-
@Override
112-
public SendResponse sendVideo(Integer chatId, String video, Integer duration, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
113-
return botApi.sendVideo(chatId, video, duration, caption, replyToMessageId, replyMarkup);
95+
public SendResponse sendVideo(Long chatId, String video, Integer duration, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
96+
return botApi.sendVideo(String.valueOf(chatId), video, duration, caption, replyToMessageId, replyMarkup);
11497
}
11598

116-
@Override
117-
public SendResponse sendVideo(Integer chatId, InputFile video, Integer duration, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
118-
return botApi.sendVideo(chatId, video, duration, caption, replyToMessageId, replyMarkup);
99+
public SendResponse sendVideo(Long chatId, InputFile video, Integer duration, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
100+
return botApi.sendVideo(String.valueOf(chatId), video, duration, caption, replyToMessageId, replyMarkup);
119101
}
120102

121-
@Override
122-
public SendResponse sendVideo(Integer chatId, InputFileBytes video, Integer duration, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
123-
return botApi.sendVideo(chatId, video, duration, caption, replyToMessageId, replyMarkup);
103+
public SendResponse sendVideo(Long chatId, InputFileBytes video, Integer duration, String caption, Integer replyToMessageId, Keyboard replyMarkup) {
104+
return botApi.sendVideo(String.valueOf(chatId), video, duration, caption, replyToMessageId, replyMarkup);
124105
}
125106

126-
@Override
127-
public SendResponse sendVoice(Integer chatId, String voice, Integer duration, Integer replyToMessageId, Keyboard replyMarkup) {
128-
return botApi.sendVoice(chatId, voice, duration, replyToMessageId, replyMarkup);
107+
public SendResponse sendVoice(Long chatId, String voice, Integer duration, Integer replyToMessageId, Keyboard replyMarkup) {
108+
return botApi.sendVoice(String.valueOf(chatId), voice, duration, replyToMessageId, replyMarkup);
129109
}
130110

131-
@Override
132-
public SendResponse sendVoice(Integer chatId, InputFile voice, Integer duration, Integer replyToMessageId, Keyboard replyMarkup) {
133-
return botApi.sendVoice(chatId, voice, duration, replyToMessageId, replyMarkup);
111+
public SendResponse sendVoice(Long chatId, InputFile voice, Integer duration, Integer replyToMessageId, Keyboard replyMarkup) {
112+
return botApi.sendVoice(String.valueOf(chatId), voice, duration, replyToMessageId, replyMarkup);
134113
}
135114

136-
@Override
137-
public SendResponse sendVoice(Integer chatId, InputFileBytes voice, Integer duration, Integer replyToMessageId, Keyboard replyMarkup) {
138-
return botApi.sendVoice(chatId, voice, duration, replyToMessageId, replyMarkup);
115+
public SendResponse sendVoice(Long chatId, InputFileBytes voice, Integer duration, Integer replyToMessageId, Keyboard replyMarkup) {
116+
return botApi.sendVoice(String.valueOf(chatId), voice, duration, replyToMessageId, replyMarkup);
139117
}
140118

141-
@Override
142-
public SendResponse sendLocation(Integer chatId, Float latitude, Float longitude, Integer replyToMessageId, Keyboard replyMarkup) {
143-
return botApi.sendLocation(chatId, latitude, longitude, replyToMessageId, replyMarkup);
119+
public SendResponse sendLocation(Long chatId, Float latitude, Float longitude, Integer replyToMessageId, Keyboard replyMarkup) {
120+
return botApi.sendLocation(String.valueOf(chatId), latitude, longitude, replyToMessageId, replyMarkup);
144121
}
145122

146-
@Override
147-
public SendChatActionResponse sendChatAction(Integer chatId, ChatAction action) {
148-
return botApi.sendChatAction(chatId, action);
123+
public SendChatActionResponse sendChatAction(Long chatId, ChatAction action) {
124+
return botApi.sendChatAction(String.valueOf(chatId), action);
149125
}
150126

151-
@Override
152127
public GetUserProfilePhotosResponse getUserProfilePhotos(Integer userId, Integer offset, Integer limit) {
153128
return botApi.getUserProfilePhotos(userId, offset, limit);
154129
}
155130

156-
@Override
157131
public GetUpdatesResponse getUpdates(Integer offset, Integer limit, Integer timeout) {
158132
return botApi.getUpdates(offset, limit, timeout);
159133
}
160134

161-
@Override
162135
public SetWebhookResponse setWebhook(String url) {
163136
return botApi.setWebhook(url);
164137
}
165138

166-
@Override
167139
public SetWebhookResponse setWebhook(String url, InputFile certificate) {
168140
return botApi.setWebhook(url, certificate);
169141
}
170142

171-
@Override
172143
public SetWebhookResponse setWebhook(String url, InputFileBytes certificate) {
173144
return botApi.setWebhook(url, certificate);
174145
}
175146

176-
@Override
177147
public GetFileResponse getFile(String fileId) {
178148
return botApi.getFile(fileId);
179149
}

0 commit comments

Comments
 (0)