Skip to content

Commit 636cd9d

Browse files
authored
Merge pull request #4 from asundukov/asundukov-path-1-add-image-sizes-to-inline-photo
add image sizes to inline photo
2 parents f778472 + a59cc82 commit 636cd9d

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

kotlin-telegram-framework/src/main/kotlin/io/cutebot/telegram/bot/model/Photo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class Photo internal constructor(
1616
}
1717

1818
fun large(): PhotoSize {
19-
return photoSizes.maxBy { it.width }!!
19+
return photoSizes.maxBy { it.data.width }!!
2020
}
2121

2222
fun small(): PhotoSize {
23-
return photoSizes.minBy { it.width }!!
23+
return photoSizes.minBy { it.data.width }!!
2424
}
2525

2626
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package io.cutebot.telegram.bot.model
2+
3+
data class PhotoData (
4+
val width: Int,
5+
val height: Int,
6+
val size: Long?
7+
)

kotlin-telegram-framework/src/main/kotlin/io/cutebot/telegram/bot/model/PhotoSize.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ class PhotoSize internal constructor(
99
token: String
1010
): FileItem(api, token, tgPhotoSize) {
1111

12-
val width: Int = tgPhotoSize.width
13-
val height: Int = tgPhotoSize.height
14-
val size: Int? = tgPhotoSize.fileSize
12+
val data: PhotoData = PhotoData(tgPhotoSize.width, tgPhotoSize.height, tgPhotoSize.fileSize)
1513

1614
}

kotlin-telegram-framework/src/main/kotlin/io/cutebot/telegram/client/model/inline/TgInlineQueryResultPhoto.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ class TgInlineQueryResultPhoto (
1515
@field: JsonProperty("thumb_url")
1616
val thumbUrl: String,
1717

18+
@field: JsonProperty("photo_width")
19+
val photoWidth: Int,
20+
21+
@field: JsonProperty("photo_height")
22+
val photoHeight: Int,
23+
1824
@field: JsonProperty
1925
val title: String = "",
2026

27+
@field: JsonProperty
28+
val caption: String? = null,
29+
2130
@field: JsonProperty
2231
val description: String? = null,
2332

33+
@field: JsonProperty("parse_mode")
34+
val parseMode: String = "HTML",
35+
2436
@field: JsonProperty("input_message_content")
2537
val inputMessageContent: TgInputMessageContent? = null,
2638

kotlin-telegram-framework/src/main/kotlin/io/cutebot/telegram/client/model/photo/TgPhotoSize.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TgPhotoSize (
1414
val height: Int,
1515

1616
@field: JsonProperty("file_size")
17-
val fileSize: Int?,
17+
val fileSize: Long?,
1818

1919
fileId: String,
2020

0 commit comments

Comments
 (0)