Skip to content

Commit 2c87c83

Browse files
committed
bugfix: the links in the messages are not parsed
reason: setParseMode("Markdown") is missing
1 parent 43c6f20 commit 2c87c83

File tree

1 file changed

+5
-3
lines changed
  • src/main/kotlin/org/moztw/bot/telegram/space

1 file changed

+5
-3
lines changed

src/main/kotlin/org/moztw/bot/telegram/space/Reply.kt

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import org.telegram.telegrambots.api.objects.Message
77
import org.telegram.telegrambots.api.objects.User
88

99
internal class Reply {
10+
private fun getGeneralMessage(chatId: Long) = SendMessage().setChatId(chatId).setParseMode("Markdown")
11+
1012
fun getGeneralMessageOpen(chatId: Long, operator: User) =
11-
SendMessage().setChatId(chatId).setText("#工寮開門 ${Bot.dateTime}(by [${operator.firstName}](tg://user?id=${operator.id}))")!!
13+
getGeneralMessage(chatId).setText("#工寮開門 ${Bot.dateTime}(by [${operator.firstName}](tg://user?id=${operator.id}))")!!
1214

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

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

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

29-
private fun getOtherMessage(chatId: Long) = SendMessage().setChatId(chatId)
31+
private fun getOtherMessage(chatId: Long) = SendMessage().setChatId(chatId).setParseMode("Markdown")
3032

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

0 commit comments

Comments
 (0)