|
| 1 | +/* |
| 2 | + * telebot |
| 3 | + * |
| 4 | + * Copyright (c) 2015 Elmurod Talipov. |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the License); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +#ifndef __TELEBOT_FORUMS_H__ |
| 20 | +#define __TELEBOT_FORUMS_H__ |
| 21 | + |
| 22 | +#include <stdbool.h> |
| 23 | +#include "telebot-types.h" |
| 24 | + |
| 25 | +#ifdef __cplusplus |
| 26 | +extern "C" { |
| 27 | +#endif |
| 28 | + |
| 29 | +/** |
| 30 | + * @file telebot-forums.h |
| 31 | + * @ingroup TELEBOT_API |
| 32 | + * @brief This file contains forums feature of telegram bot |
| 33 | + * @author Elmurod Talipov |
| 34 | + * @date 2026-02-27 |
| 35 | + */ |
| 36 | + |
| 37 | +/** |
| 38 | + * @addtogroup TELEBOT_API |
| 39 | + * @{ |
| 40 | + */ |
| 41 | + |
| 42 | +/** |
| 43 | + * @brief Use this method to create a topic in a forum supergroup chat. |
| 44 | + * @param[in] handle The telebot handler. |
| 45 | + * @param[in] chat_id Unique identifier for the target chat. |
| 46 | + * @param[in] name Topic name, 1-128 characters. |
| 47 | + * @param[in] icon_color Color of the topic icon in RGB format. |
| 48 | + * @param[in] icon_custom_emoji_id Unique identifier of the custom emoji used as the topic icon. |
| 49 | + * @param[out] topic Pointer to get ForumTopic, MUST be released with #telebot_put_forum_topic. |
| 50 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 51 | + * error value. |
| 52 | + */ |
| 53 | +telebot_error_e telebot_create_forum_topic(telebot_handler_t handle, |
| 54 | + long long int chat_id, const char *name, int icon_color, const char *icon_custom_emoji_id, |
| 55 | + telebot_forum_topic_t *topic); |
| 56 | + |
| 57 | +/** |
| 58 | + * @brief Release forum topic obtained with #telebot_create_forum_topic. |
| 59 | + * @param[in] topic Pointer to forum topic to be released. |
| 60 | + * @return on Success, #TELEBOT_ERROR_NONE is returned. |
| 61 | + */ |
| 62 | +telebot_error_e telebot_put_forum_topic(telebot_forum_topic_t *topic); |
| 63 | + |
| 64 | +/** |
| 65 | + * @brief Use this method to edit name and icon of a topic in a forum supergroup chat. |
| 66 | + * @param[in] handle The telebot handler. |
| 67 | + * @param[in] chat_id Unique identifier for the target chat. |
| 68 | + * @param[in] message_thread_id Unique identifier for the target message thread of the forum topic. |
| 69 | + * @param[in] name New topic name, 0-128 characters. |
| 70 | + * @param[in] icon_custom_emoji_id New unique identifier of the custom emoji used as the topic icon. |
| 71 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 72 | + * error value. |
| 73 | + */ |
| 74 | +telebot_error_e telebot_edit_forum_topic(telebot_handler_t handle, |
| 75 | + long long int chat_id, int message_thread_id, const char *name, const char *icon_custom_emoji_id); |
| 76 | + |
| 77 | +/** |
| 78 | + * @brief Use this method to close an open topic in a forum supergroup chat. |
| 79 | + * @param[in] handle The telebot handler. |
| 80 | + * @param[in] chat_id Unique identifier for the target chat. |
| 81 | + * @param[in] message_thread_id Unique identifier for the target message thread of the forum topic. |
| 82 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 83 | + * error value. |
| 84 | + */ |
| 85 | +telebot_error_e telebot_close_forum_topic(telebot_handler_t handle, |
| 86 | + long long int chat_id, int message_thread_id); |
| 87 | + |
| 88 | +/** |
| 89 | + * @brief Use this method to reopen a closed topic in a forum supergroup chat. |
| 90 | + * @param[in] handle The telebot handler. |
| 91 | + * @param[in] chat_id Unique identifier for the target chat. |
| 92 | + * @param[in] message_thread_id Unique identifier for the target message thread of the forum topic. |
| 93 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 94 | + * error value. |
| 95 | + */ |
| 96 | +telebot_error_e telebot_reopen_forum_topic(telebot_handler_t handle, |
| 97 | + long long int chat_id, int message_thread_id); |
| 98 | + |
| 99 | +/** |
| 100 | + * @brief Use this method to delete a forum topic along with all its messages in a forum supergroup chat. |
| 101 | + * @param[in] handle The telebot handler. |
| 102 | + * @param[in] chat_id Unique identifier for the target chat. |
| 103 | + * @param[in] message_thread_id Unique identifier for the target message thread of the forum topic. |
| 104 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 105 | + * error value. |
| 106 | + */ |
| 107 | +telebot_error_e telebot_delete_forum_topic(telebot_handler_t handle, |
| 108 | + long long int chat_id, int message_thread_id); |
| 109 | + |
| 110 | +/** |
| 111 | + * @brief Use this method to unpin all messages in a forum topic. |
| 112 | + * @param[in] handle The telebot handler. |
| 113 | + * @param[in] chat_id Unique identifier for the target chat. |
| 114 | + * @param[in] message_thread_id Unique identifier for the target message thread of the forum topic. |
| 115 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 116 | + * error value. |
| 117 | + */ |
| 118 | +telebot_error_e telebot_unpin_all_forum_topic_messages(telebot_handler_t handle, |
| 119 | + long long int chat_id, int message_thread_id); |
| 120 | + |
| 121 | +/** |
| 122 | + * @brief Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. |
| 123 | + * @param[in] handle The telebot handler. |
| 124 | + * @param[out] stickers Pointer to stickers to be obtained, MUST be released with #telebot_put_stickers. |
| 125 | + * @param[out] count Pointer to get the number of stickers. |
| 126 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 127 | + * error value. |
| 128 | + */ |
| 129 | +telebot_error_e telebot_get_forum_topic_icon_stickers(telebot_handler_t handle, |
| 130 | + telebot_sticker_t **stickers, int *count); |
| 131 | + |
| 132 | +/** |
| 133 | + * @brief Use this method to edit the name of the 'General' topic in a forum supergroup chat. |
| 134 | + * @param[in] handle The telebot handler. |
| 135 | + * @param[in] chat_id Unique identifier for the target chat. |
| 136 | + * @param[in] name New topic name, 1-128 characters. |
| 137 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 138 | + * error value. |
| 139 | + */ |
| 140 | +telebot_error_e telebot_edit_general_forum_topic(telebot_handler_t handle, |
| 141 | + long long int chat_id, const char *name); |
| 142 | + |
| 143 | +/** |
| 144 | + * @brief Use this method to close an open 'General' topic in a forum supergroup chat. |
| 145 | + * @param[in] handle The telebot handler. |
| 146 | + * @param[in] chat_id Unique identifier for the target chat. |
| 147 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 148 | + * error value. |
| 149 | + */ |
| 150 | +telebot_error_e telebot_close_general_forum_topic(telebot_handler_t handle, |
| 151 | + long long int chat_id); |
| 152 | + |
| 153 | +/** |
| 154 | + * @brief Use this method to reopen a closed 'General' topic in a forum supergroup chat. |
| 155 | + * @param[in] handle The telebot handler. |
| 156 | + * @param[in] chat_id Unique identifier for the target chat. |
| 157 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 158 | + * error value. |
| 159 | + */ |
| 160 | +telebot_error_e telebot_reopen_general_forum_topic(telebot_handler_t handle, |
| 161 | + long long int chat_id); |
| 162 | + |
| 163 | +/** |
| 164 | + * @brief Use this method to hide the 'General' topic in a forum supergroup chat. |
| 165 | + * @param[in] handle The telebot handler. |
| 166 | + * @param[in] chat_id Unique identifier for the target chat. |
| 167 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 168 | + * error value. |
| 169 | + */ |
| 170 | +telebot_error_e telebot_hide_general_forum_topic(telebot_handler_t handle, |
| 171 | + long long int chat_id); |
| 172 | + |
| 173 | +/** |
| 174 | + * @brief Use this method to unhide the 'General' topic in a forum supergroup chat. |
| 175 | + * @param[in] handle The telebot handler. |
| 176 | + * @param[in] chat_id Unique identifier for the target chat. |
| 177 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 178 | + * error value. |
| 179 | + */ |
| 180 | +telebot_error_e telebot_unhide_general_forum_topic(telebot_handler_t handle, |
| 181 | + long long int chat_id); |
| 182 | + |
| 183 | +/** |
| 184 | + * @brief Use this method to unpin all messages in a General forum topic. |
| 185 | + * @param[in] handle The telebot handler. |
| 186 | + * @param[in] chat_id Unique identifier for the target chat. |
| 187 | + * @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative |
| 188 | + * error value. |
| 189 | + */ |
| 190 | +telebot_error_e telebot_unpin_all_general_forum_topic_messages(telebot_handler_t handle, |
| 191 | + long long int chat_id); |
| 192 | + |
| 193 | +/** |
| 194 | + * @} // end of APIs |
| 195 | + */ |
| 196 | + |
| 197 | +#ifdef __cplusplus |
| 198 | +} |
| 199 | +#endif |
| 200 | + |
| 201 | +#endif /* __TELEBOT_FORUMS_H__ */ |
0 commit comments