1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-07 17:19:24 +00:00

add support of PostStory and EditStory

This commit is contained in:
2025-05-10 22:32:38 +06:00
parent effd12711f
commit e7367da3cb
9 changed files with 531 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
package dev.inmo.tgbotapi.extensions.api.stories
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.stories.EditStory
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.StoryId
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.stories.InputStoryContent
import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.stories.StoryArea
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
textSources: List<TextSource>,
areas: List<StoryArea> = emptyList(),
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
textSources = textSources,
areas = areas,
)
)
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
text: String,
parseMode: ParseMode? = null,
areas: List<StoryArea> = emptyList(),
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
text = text,
parseMode = parseMode,
areas = areas,
)
)
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
areas: List<StoryArea> = emptyList(),
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
areas = areas,
)
)

View File

@@ -0,0 +1,71 @@
package dev.inmo.tgbotapi.extensions.api.stories
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.stories.PostStory
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.stories.InputStoryContent
import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.stories.StoryArea
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
textSources: List<TextSource>,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
textSources = textSources,
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
text: String,
parseMode: ParseMode? = null,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
text = text,
parseMode = parseMode,
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)