Skip to content

Commit

Permalink
Fix/telegram library fix (#24)
Browse files Browse the repository at this point in the history
* telegram library version upgrade

* 0.4.4
  • Loading branch information
morfeusys authored Jul 2, 2020
1 parent 774234d commit 4a60946
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {
allprojects {

group = "com.justai.jaicf"
version = "0.5.0"
version = "0.4.4"

repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion channels/telegram/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies {
implementation(project(":core"))
implementation(kotlin("stdlib", Version.stdLib))

api("io.github.seik.kotlin-telegram-bot:telegram:0.3.4") {
api("com.github.kotlin-telegram-bot:kotlin-telegram-bot:5.0.0") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.justai.jaicf.channel.telegram

import com.github.kotlintelegrambot.entities.Contact
import com.github.kotlintelegrambot.entities.Location
import com.github.kotlintelegrambot.entities.Message
import com.justai.jaicf.api.BotRequest
import com.justai.jaicf.api.EventBotRequest
import com.justai.jaicf.api.QueryBotRequest
import me.ivmg.telegram.entities.Contact
import me.ivmg.telegram.entities.Location
import me.ivmg.telegram.entities.Message
import me.ivmg.telegram.entities.payment.PreCheckoutQuery

val BotRequest.telegram
get() = this as? TelegramBotRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.justai.jaicf.channel.telegram

import com.github.kotlintelegrambot.bot
import com.github.kotlintelegrambot.dispatch
import com.github.kotlintelegrambot.dispatcher.callbackQuery
import com.github.kotlintelegrambot.dispatcher.contact
import com.github.kotlintelegrambot.dispatcher.location
import com.github.kotlintelegrambot.dispatcher.text
import com.justai.jaicf.api.BotApi
import com.justai.jaicf.channel.BotChannel
import com.justai.jaicf.channel.jaicp.JaicpExternalPollingChannelFactory
import me.ivmg.telegram.bot
import me.ivmg.telegram.dispatch
import me.ivmg.telegram.dispatcher.*
import okhttp3.logging.HttpLoggingInterceptor

class TelegramChannel(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.justai.jaicf.channel.telegram

import com.github.kotlintelegrambot.Bot
import com.github.kotlintelegrambot.entities.InlineKeyboardButton
import com.github.kotlintelegrambot.entities.InlineKeyboardMarkup
import com.github.kotlintelegrambot.entities.ParseMode
import com.github.kotlintelegrambot.entities.ReplyMarkup
import com.github.kotlintelegrambot.entities.inputmedia.InputMedia
import com.github.kotlintelegrambot.entities.inputmedia.MediaGroup
import com.justai.jaicf.reactions.Reactions
import me.ivmg.telegram.Bot
import me.ivmg.telegram.entities.*

val Reactions.telegram
get() = this as? TelegramReactions
Expand Down Expand Up @@ -51,16 +56,20 @@ class TelegramReactions(
fun image(
url: String,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean? = null,
replyToMessageId: Long? = null
) = sendPhoto(url, caption, disableNotification, replyToMessageId)
replyToMessageId: Long? = null,
replyMarkup: ReplyMarkup? = null
) = sendPhoto(url, caption, parseMode, disableNotification, replyToMessageId, replyMarkup)

fun sendPhoto(
url: String,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean? = null,
replyToMessageId: Long? = null
) = api.sendPhoto(chatId, url, caption, disableNotification, replyToMessageId)
replyToMessageId: Long? = null,
replyMarkup: ReplyMarkup? = null
) = api.sendPhoto(chatId, url, caption, parseMode, disableNotification, replyToMessageId, replyMarkup)

fun sendVideo(
url: String,
Expand Down Expand Up @@ -94,21 +103,23 @@ class TelegramReactions(
fun sendDocument(
url: String,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean? = null,
replyToMessageId: Long? = null,
replyMarkup: ReplyMarkup? = null
) = api.sendDocument(chatId, url, caption, disableNotification, replyToMessageId, replyMarkup)
) = api.sendDocument(chatId, url, caption, parseMode, disableNotification, replyToMessageId, replyMarkup)

fun sendVenue(
latitude: Float,
longitude: Float,
title: String,
address: String,
foursquareId: String? = null,
foursquareType: String? = null,
disableNotification: Boolean? = null,
replyToMessageId: Long? = null,
replyMarkup: ReplyMarkup? = null
) = api.sendVenue(chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup)
) = api.sendVenue(chatId, latitude, longitude, title, address, foursquareId, foursquareType, disableNotification, replyToMessageId, replyMarkup)

fun sendContact(
phoneNumber: String,
Expand All @@ -129,10 +140,10 @@ class TelegramReactions(
) = api.sendLocation(chatId, latitude, longitude, livePeriod, disableNotification, replyToMessageId, replyMarkup)

fun sendMediaGroup(
media: List<InputMedia>,
mediaGroup: MediaGroup,
disableNotification: Boolean? = null,
replyToMessageId: Long? = null
) = api.sendMediaGroup(chatId, media, disableNotification, replyToMessageId)
) = api.sendMediaGroup(chatId, mediaGroup, disableNotification, replyToMessageId)

fun sendVideoNote(
url: String,
Expand Down

0 comments on commit 4a60946

Please sign in to comment.