Skip to content

Commit c8bc0d0

Browse files
committed
Merge branch 'renyhp/current_master'
2 parents a71cf9e + 49ec9da commit c8bc0d0

File tree

2 files changed

+48
-11
lines changed

2 files changed

+48
-11
lines changed

botogram/objects/mixins.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@ def send_photo(self, path, caption=None, reply_to=None, extra=None,
103103
expect=_objects().Message)
104104

105105
@_require_api
106-
def send_audio(self, path, duration=None, performer=None, title=None,
107-
reply_to=None, extra=None, attach=None, notify=True):
106+
def send_audio(self, path, duration=None, performer=None,
107+
title=None, reply_to=None, extra=None, attach=None,
108+
notify=True, caption=None):
108109
"""Send an audio track"""
109110
args = self._get_call_args(reply_to, extra, attach, notify)
111+
if caption is not None:
112+
args["caption"] = caption
110113
if duration is not None:
111114
args["duration"] = duration
112115
if performer is not None:
@@ -121,9 +124,11 @@ def send_audio(self, path, duration=None, performer=None, title=None,
121124

122125
@_require_api
123126
def send_voice(self, path, duration=None, title=None, reply_to=None,
124-
extra=None, attach=None, notify=True):
127+
extra=None, attach=None, notify=True, caption=None):
125128
"""Send a voice message"""
126129
args = self._get_call_args(reply_to, extra, attach, notify)
130+
if caption is not None:
131+
args["caption"] = caption
127132
if duration is not None:
128133
args["duration"] = duration
129134

@@ -148,10 +153,12 @@ def send_video(self, path, duration=None, caption=None, reply_to=None,
148153
expect=_objects().Message)
149154

150155
@_require_api
151-
def send_file(self, path, reply_to=None, extra=None, attach=None,
152-
notify=True):
156+
def send_file(self, path, reply_to=None, extra=None,
157+
attach=None, notify=True, caption=None):
153158
"""Send a generic file"""
154159
args = self._get_call_args(reply_to, extra, attach, notify)
160+
if caption is not None:
161+
args["caption"] = caption
155162

156163
files = {"document": open(path, "rb")}
157164

docs/api/telegram.rst

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ about its business.
155155

156156
Now the method returns the sent message
157157

158-
.. py:method:: send_audio(path, [duration=None, performer=None, title=None, reply_to=None, attach=None, extra=None, notify=True])
158+
.. py:method:: send_audio(path, [duration=None, performer=None, title=None, reply_to=None, attach=None, extra=None, notify=True, caption=None])
159159
160160
Send the audio track found in the *path* to the user. You may optionally
161161
specify the *duration*, the *performer* and the *title* of the audio
@@ -176,6 +176,7 @@ about its business.
176176
:param object attach: An extra thing to attach to the message.
177177
:param object extra: An extra reply interface object to attach
178178
:param bool notify: If you want to trigger the client notification.
179+
:param str caption: A caption for the audio track.
179180
:returns: The message you sent
180181
:rtype: ~botogram.Message
181182

@@ -186,8 +187,12 @@ about its business.
186187
.. versionchanged:: 0.3
187188

188189
Now the method returns the sent message
190+
191+
.. versionchanged:: 0.5
189192

190-
.. py:method:: send_voice(chat, path, [duration=None, reply_to=None, attach=None, extra=None, notify=True])
193+
Added support for caption
194+
195+
.. py:method:: send_voice(chat, path, [duration=None, reply_to=None, attach=None, extra=None, notify=True, caption=None])
191196
192197
Send the voice message found in the *path* to the user. You may
193198
optionally specify the *duration* of the voice message. If the voice
@@ -206,6 +211,7 @@ about its business.
206211
:param object attach: An extra thing to attach to the message.
207212
:param object extra: An extra reply interface object to attach
208213
:param bool notify: If you want to trigger the client notification.
214+
:param str caption: A caption for the voice message.
209215
:returns: The message you sent
210216
:rtype: ~botogram.Message
211217

@@ -216,6 +222,10 @@ about its business.
216222
.. versionchanged:: 0.3
217223

218224
Now the method returns the sent message
225+
226+
.. versionchanged:: 0.5
227+
228+
Added support for caption
219229

220230
.. py:method:: send_video(path, [duration=None, caption=None, reply_to=None, attach=None, extra=None, notify=True])
221231
@@ -248,7 +258,7 @@ about its business.
248258

249259
Now the method returns the sent message
250260

251-
.. py:method:: send_file(path, [reply_to=None, attach=None, extra=None, notify=True])
261+
.. py:method:: send_file(path, [reply_to=None, attach=None, extra=None, notify=True, caption=None])
252262
253263
Send the generic file found in the *path* to the user. If the file you're
254264
sending is in reply to another message, set *reply_to* to the ID of the
@@ -265,6 +275,7 @@ about its business.
265275
:param object attach: An extra thing to attach to the message.
266276
:param object extra: An extra reply interface object to attach
267277
:param bool notify: If you want to trigger the client notification.
278+
:param str caption: A caption for the file.
268279
:returns: The message you sent
269280
:rtype: ~botogram.Message
270281

@@ -275,6 +286,10 @@ about its business.
275286
.. versionchanged:: 0.3
276287

277288
Now the method returns the sent message
289+
290+
.. versionchanged:: 0.5
291+
292+
Added support for caption
278293

279294
.. py:method:: send_location(latitude, longitude, [reply_to=None, attach=None, extra=None, notify=True])
280295
@@ -728,7 +743,7 @@ about its business.
728743

729744
Now the method returns the sent message
730745

731-
.. py:method:: send_audio(path, [duration=None, performer=None, title=None, reply_to=None, attach=None, extra=None, notify=True])
746+
.. py:method:: send_audio(path, [duration=None, performer=None, title=None, reply_to=None, attach=None, extra=None, notify=True, caption=None])
732747
733748
Send the audio track found in the *path* to the chat. You may optionally
734749
specify the *duration*, the *performer* and the *title* of the audio
@@ -749,6 +764,7 @@ about its business.
749764
:param object attach: An extra thing to attach to the message.
750765
:param object extra: An extra reply interface object to attach
751766
:param bool notify: If you want to trigger the client notification.
767+
:param str caption: A caption for the audio track.
752768
:returns: The message you sent
753769
:rtype: ~botogram.Message
754770

@@ -760,7 +776,11 @@ about its business.
760776

761777
Now the method returns the sent message
762778

763-
.. py:method:: send_voice(chat, path, [duration=None, reply_to=None, attach=None, extra=None, notify=True])
779+
.. versionchanged:: 0.5
780+
781+
Added support for caption
782+
783+
.. py:method:: send_voice(chat, path, [duration=None, reply_to=None, attach=None, extra=None, notify=True, caption=None])
764784
765785
Send the voice message found in the *path* to the chat. You may
766786
optionally specify the *duration* of the voice message. If the voice
@@ -779,6 +799,7 @@ about its business.
779799
:param object attach: An extra thing to attach to the message.
780800
:param object extra: An extra reply interface object to attach
781801
:param bool notify: If you want to trigger the client notification.
802+
:param str caption: A caption for the voice message.
782803
:returns: The message you sent
783804
:rtype: ~botogram.Message
784805

@@ -790,6 +811,10 @@ about its business.
790811

791812
Now the method returns the sent message
792813

814+
.. versionchanged:: 0.5
815+
816+
Added support for caption
817+
793818
.. py:method:: send_video(path, [duration=None, caption=None, reply_to=None, attach=None, extra=None, notify=True])
794819
795820
Send the video found in the *path* to the chat. You may optionally
@@ -821,7 +846,7 @@ about its business.
821846

822847
Now the method returns the sent message
823848

824-
.. py:method:: send_file(path, [reply_to=None, attach=None, extra=None, notify=True])
849+
.. py:method:: send_file(path, [reply_to=None, attach=None, extra=None, notify=True, caption=None])
825850
826851
Send the generic file found in the *path* to the chat. If the file you're
827852
sending is in reply to another message, set *reply_to* to the ID of the
@@ -838,6 +863,7 @@ about its business.
838863
:param object attach: An extra thing to attach to the message.
839864
:param object extra: An extra reply interface object to attach
840865
:param bool notify: If you want to trigger the client notification.
866+
:param str caption: A caption for the file.
841867
:returns: The message you sent
842868
:rtype: ~botogram.Message
843869

@@ -849,6 +875,10 @@ about its business.
849875

850876
Now the method returns the sent message
851877

878+
.. versionchanged:: 0.5
879+
880+
Added support for caption
881+
852882
.. py:method:: send_location(latitude, longitude, [reply_to=None, attach=None, extra=None, notify=True])
853883
854884
Send the geographic location to the chat. If the location you're sending

0 commit comments

Comments
 (0)