@@ -158,6 +158,64 @@ about how to create them in the ":ref:`custom-components`" chapter.
158158
159159 .. versionadded :: 0.3
160160
161+ .. py :method :: add_channel_post_hook(func)
162+
163+ All the functions provided to this method will receive all the messages
164+ posted to channels the bot is a member of. This allows you to act when
165+ certain messages are received, as an example.
166+
167+ You can :ref: `request the following arguments <bot-structure-hooks-args >`
168+ in the provided functions:
169+
170+ * **chat **: the chat in which the channel post was originally sent
171+ (instance of :py:class: `~botogram.Chat `)
172+
173+ * **message **: the message (instance of :py:class: `~botogram.Message `)
174+
175+ .. code-block :: python
176+
177+ class ChannelAckComponent (botogram .Component ):
178+ component_name = " channel-ack"
179+
180+ def __init__ (self ):
181+ self .add_channel_post_hook(self .reply)
182+
183+ def reply (self , chat , message ):
184+ message.reply(" I read this post!" )
185+
186+ :param callable func: The function you want to use.
187+
188+ .. versionadded :: 0.4
189+
190+ .. py :method :: add_channel_post_edited_hook(func)
191+
192+ All the functions provided to this method will receive all the messages
193+ edited in channels the bot is a member of. This allows you to act when
194+ certain messages are changed, as an example.
195+
196+ You can :ref: `request the following arguments <bot-structure-hooks-args >`
197+ in the provided functions:
198+
199+ * **chat **: the chat in which the channel post was originally sent
200+ (instance of :py:class: `~botogram.Chat `)
201+
202+ * **message **: the (new) edited message (instance of :py:class: `~botogram.Message `)
203+
204+ .. code-block :: python
205+
206+ class ChannelAlertComponent (botogram .Component ):
207+ component_name = " channel-alert"
208+
209+ def __init__ (self ):
210+ self .add_channel_post_edited_hook(self .reply)
211+
212+ def reply (self , chat , message ):
213+ message.reply(" This post is changed!" )
214+
215+ :param callable func: The function you want to use.
216+
217+ .. versionadded :: 0.4
218+
161219 .. py :method :: add_command(name, func, [hidden=False , order=0 ])
162220
163221 This function registers a new command, and calls the provided function
0 commit comments