mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-23 02:28:45 +00:00
logical fixes
This commit is contained in:
parent
e43ad41d2f
commit
7d0009039f
@ -39,13 +39,10 @@ suspend fun RequestsExecutor.pinChatMessage(
|
|||||||
) = pinChatMessage(chat.id, messageId, disableNotification)
|
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.pinChatMessage(
|
suspend fun RequestsExecutor.pinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
|
||||||
message: Message,
|
message: Message,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
) = pinChatMessage(chatId, message.messageId, disableNotification)
|
) = if (message.chat is PublicChat) {
|
||||||
|
pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
||||||
suspend fun RequestsExecutor.pinChatMessage(
|
} else {
|
||||||
chat: PublicChat,
|
error("It is possible to pin messages only in non one-to-one chats")
|
||||||
message: Message,
|
}
|
||||||
disableNotification: Boolean = false
|
|
||||||
) = pinChatMessage(chat.id, message.messageId, disableNotification)
|
|
||||||
|
@ -26,12 +26,12 @@ data class SetChatPhoto (
|
|||||||
override val paramsJson: JsonObject = toJson(serializer())
|
override val paramsJson: JsonObject = toJson(serializer())
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun RequestsExecutor.setChatPermissions(
|
suspend fun RequestsExecutor.setChatPhoto(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
photo: MultipartFile
|
photo: MultipartFile
|
||||||
) = execute(SetChatPhoto(chatId, photo))
|
) = execute(SetChatPhoto(chatId, photo))
|
||||||
|
|
||||||
suspend fun RequestsExecutor.setChatPermissions(
|
suspend fun RequestsExecutor.setChatPhoto(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
photo: MultipartFile
|
photo: MultipartFile
|
||||||
) = setChatPermissions(chat.id, photo)
|
) = setChatPhoto(chat.id, photo)
|
||||||
|
@ -49,14 +49,7 @@ suspend fun RequestsExecutor.editMessageReplyMarkup(
|
|||||||
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
|
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||||
chatId: ChatId,
|
|
||||||
message: Message,
|
message: Message,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageReplyMarkup(chatId, message.messageId, replyMarkup)
|
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
|
||||||
chat: Chat,
|
|
||||||
message: Message,
|
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
|
||||||
) = editMessageReplyMarkup(chat.id, message.messageId, replyMarkup)
|
|
||||||
|
|
||||||
|
@ -60,21 +60,10 @@ suspend fun RequestsExecutor.editMessageCaption(
|
|||||||
) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup)
|
) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup)
|
||||||
|
|
||||||
suspend fun <T> RequestsExecutor.editMessageCaption(
|
suspend fun <T> RequestsExecutor.editMessageCaption(
|
||||||
chatId: ChatId,
|
|
||||||
message: ContentMessage<T>,
|
message: ContentMessage<T>,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
|
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
|
||||||
return editMessageCaption(chatId, message.messageId, text, parseMode, replyMarkup)
|
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup)
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun <T> RequestsExecutor.editMessageCaption(
|
|
||||||
chat: Chat,
|
|
||||||
message: ContentMessage<T>,
|
|
||||||
text: String,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
|
||||||
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
|
|
||||||
return editMessageCaption(chat.id, message.messageId, text, parseMode, replyMarkup)
|
|
||||||
}
|
}
|
||||||
|
@ -63,15 +63,7 @@ suspend fun RequestsExecutor.editMessageMedia(
|
|||||||
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
|
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.editMessageMedia(
|
suspend fun RequestsExecutor.editMessageMedia(
|
||||||
chatId: ChatId,
|
|
||||||
message: ContentMessage<out MediaContent>,
|
message: ContentMessage<out MediaContent>,
|
||||||
media: InputMedia,
|
media: InputMedia,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageMedia(chatId, message.messageId, media, replyMarkup)
|
) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.editMessageMedia(
|
|
||||||
chat: Chat,
|
|
||||||
message: ContentMessage<out MediaContent>,
|
|
||||||
media: InputMedia,
|
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
|
||||||
) = editMessageMedia(chat.id, message.messageId, media, replyMarkup)
|
|
||||||
|
@ -59,19 +59,9 @@ suspend fun RequestsExecutor.editMessageText(
|
|||||||
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.editMessageText(
|
suspend fun RequestsExecutor.editMessageText(
|
||||||
chatId: ChatId,
|
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chatId, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.editMessageText(
|
|
||||||
chat: Chat,
|
|
||||||
message: ContentMessage<TextContent>,
|
|
||||||
text: String,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableWebPagePreview: Boolean? = null,
|
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
|
||||||
) = editMessageText(chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
|
Loading…
Reference in New Issue
Block a user