Skip to content

Commit

Permalink
bugfix: the links in the messages are not parsed
Browse files Browse the repository at this point in the history
reason: setParseMode("Markdown") is missing
  • Loading branch information
mingtsay committed Mar 2, 2018
1 parent 43c6f20 commit 2c87c83
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/kotlin/org/moztw/bot/telegram/space/Reply.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import org.telegram.telegrambots.api.objects.Message
import org.telegram.telegrambots.api.objects.User

internal class Reply {
private fun getGeneralMessage(chatId: Long) = SendMessage().setChatId(chatId).setParseMode("Markdown")

fun getGeneralMessageOpen(chatId: Long, operator: User) =
SendMessage().setChatId(chatId).setText("#工寮開門 ${Bot.dateTime}(by [${operator.firstName}](tg://user?id=${operator.id}))")!!
getGeneralMessage(chatId).setText("#工寮開門 ${Bot.dateTime}(by [${operator.firstName}](tg://user?id=${operator.id}))")!!

fun getGeneralMessageClose(chatId: Long, operator: User) =
SendMessage().setChatId(chatId).setText("#工寮關門 ${Bot.dateTime}(by [${operator.firstName}](tg://user?id=${operator.id}))")!!
getGeneralMessage(chatId).setText("#工寮關門 ${Bot.dateTime}(by [${operator.firstName}](tg://user?id=${operator.id}))")!!

private fun getMessage(message: Message) = SendMessage().setChatId(message.chatId!!).setReplyToMessageId(message.messageId)

Expand All @@ -26,7 +28,7 @@ internal class Reply {
"請檢視以下項目是否完成,完成後可點選來標記:"
).setReplyMarkup(Keyboard().showButton)!!

private fun getOtherMessage(chatId: Long) = SendMessage().setChatId(chatId)
private fun getOtherMessage(chatId: Long) = SendMessage().setChatId(chatId).setParseMode("Markdown")

fun getOtherMessageOpen(message: Message, chatId: Long, operator: User) =
getOtherMessage(chatId).setText("#工寮開門 [${operator.firstName}](tg://user?id=${operator.id}) 已從「${message.chat.title}」群組於 ${Bot.dateTime} 送出開門資訊。")!!
Expand Down

0 comments on commit 2c87c83

Please sign in to comment.