mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add api extensions for topics requests
This commit is contained in:
parent
aca4d90608
commit
bdbca92fe5
@ -0,0 +1,32 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
suspend fun TelegramBot.closeForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
CloseForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.closeForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = closeForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.closeForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = closeForumTopic(chat.id, forumTopic.messageThreadId)
|
@ -0,0 +1,32 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
name: String,
|
||||||
|
color: RGBColor,
|
||||||
|
iconEmojiId: CustomEmojiId? = null
|
||||||
|
) = execute(
|
||||||
|
CreateForumTopic(
|
||||||
|
chatId,
|
||||||
|
name,
|
||||||
|
color,
|
||||||
|
iconEmojiId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
name: String,
|
||||||
|
color: RGBColor,
|
||||||
|
iconEmojiId: CustomEmojiId? = null
|
||||||
|
) = createForumTopic(chat.id, name, color, iconEmojiId)
|
@ -0,0 +1,33 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.DeleteForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
DeleteForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = deleteForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = deleteForumTopic(chat.id, forumTopic.messageThreadId)
|
@ -0,0 +1,39 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.EditForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId,
|
||||||
|
name: String,
|
||||||
|
iconEmojiId: CustomEmojiId
|
||||||
|
) = execute(
|
||||||
|
EditForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId,
|
||||||
|
name,
|
||||||
|
iconEmojiId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId,
|
||||||
|
name: String,
|
||||||
|
iconEmojiId: CustomEmojiId
|
||||||
|
) = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editForumTopic(
|
||||||
|
chatIdentifier: ChatIdentifier,
|
||||||
|
forumTopic: ForumTopic,
|
||||||
|
iconEmojiId: CustomEmojiId = forumTopic.iconEmojiId ?: error("Icon emoji id in forum topic should be presented when edit forum topic basing on other forum topic object")
|
||||||
|
) = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)
|
@ -0,0 +1,33 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.ReopenForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reopenForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
ReopenForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reopenForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = reopenForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reopenForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = reopenForumTopic(chat.id, forumTopic.messageThreadId)
|
@ -0,0 +1,33 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.UnpinAllForumTopicMessages
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
UnpinAllForumTopicMessages(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = unpinAllForumTopicMessages(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)
|
Loading…
Reference in New Issue
Block a user