Skip to content
This repository was archived by the owner on Aug 25, 2023. It is now read-only.

Commit 4fb01f5

Browse files
committed
Documentation for the Message object
1 parent 98ddb99 commit 4fb01f5

File tree

2 files changed

+132
-3
lines changed

2 files changed

+132
-3
lines changed

docs/objects/Bot.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ editMessageText = (id, text, inline, options, chat_id)
183183
* ``id`` <String>
184184
* ``text`` <String>
185185
* ``inline`` <Boolean> Is the message an inline one?
186-
* ``options`` <Object> *Optional*
186+
* ``options`` <Object>
187187
* ``chat_id`` <String>|<Chat>|<User>
188188

189189
Updates the the specified message in the specified chat and returns a promise that resolves to a :doc:`Message` object
@@ -196,7 +196,7 @@ editMessageCaption = (id, caption, inline, options, chat_id)
196196
* ``id`` <String>
197197
* ``caption`` <String>
198198
* ``inline`` <Boolean> Is the message an inline one?
199-
* ``options`` <Object> *Optional*
199+
* ``options`` <Object>
200200
* ``chat_id`` <String>|<Chat>|<User>
201201

202202
Updates the the specified message caption in the specified chat and returns a promise that resolves to a :doc:`Message`
@@ -209,7 +209,7 @@ editMessageReplyMarkup = (id, markup, inline, options, chat_id)
209209
* ``id`` <String>
210210
* ``markup`` <Keyboard>
211211
* ``inline`` <Boolean> Is the message an inline one?
212-
* ``options`` <Object> *Optional*
212+
* ``options`` <Object>
213213
* ``chat_id`` <String>|<Chat>|<User>
214214

215215
Updates the the specified message markup in the specified chat and returns a promise that resolves to a :doc:`Message`

docs/objects/Message.rst

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
Message
2+
=======
3+
4+
This object represents a Telegram message.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#message>`_.
9+
10+
====================
11+
Message(object, bot)
12+
====================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new Message object.
19+
20+
====================
21+
reply(text, options)
22+
====================
23+
24+
* ``text`` <String>
25+
* ``options`` <Object> *Optional*
26+
27+
Replies to the message and returns a promise that resolves to a :doc:`Message` object representing what has been sent.
28+
29+
=========================
30+
forward(chat_id, options)
31+
=========================
32+
33+
* ``chat_id`` <String>|<Chat>|<User>
34+
* ``options`` <Object> *Optional*
35+
36+
Forwards the message to the specified chat and returns a promise that resolves to a :doc:`Message` object representing
37+
what has been sent.
38+
39+
==================================
40+
editText = (text, inline, options)
41+
==================================
42+
43+
* ``text`` <String>
44+
* ``inline`` <Boolean> Is the message an inline one?
45+
* ``options`` <Object> *Optional*
46+
47+
Updates the the specified message in the specified chat and returns a promise that resolves to a :doc:`Message` object
48+
representing the updated message. True is returned by the promise if the message is an inline one.
49+
50+
========================================
51+
editCaption = (caption, inline, options)
52+
========================================
53+
54+
* ``caption`` <String>
55+
* ``inline`` <Boolean> Is the message an inline one?
56+
* ``options`` <Object> *Optional*
57+
58+
Updates the the specified message caption in the specified chat and returns a promise that resolves to a :doc:`Message`
59+
object representing the updated message. True is returned by the promise if the message is an inline one.
60+
61+
===========================================
62+
editReplyMarkup = (markup, inline, options)
63+
===========================================
64+
65+
* ``markup`` <Keyboard>
66+
* ``inline`` <Boolean> Is the message an inline one?
67+
* ``options`` <Object> *Optional*
68+
69+
Updates the the specified message markup in the specified chat and returns a promise that resolves to a :doc:`Message`
70+
object representing the updated message. True is returned by the promise if the message is an inline one.
71+
72+
========
73+
commands
74+
========
75+
<Array> Array of objects, each one representing a command in the message.
76+
77+
.. code-block:: javascript
78+
79+
// Recipient is undefined if it's a direct command
80+
{command: '/echo', recipient: 'yourbot', args: ['Many', 'things']}
81+
82+
========
83+
mentions
84+
========
85+
86+
<Array> Array of strings, each one representing a mention (e.g. @nickname) in the message.
87+
88+
========
89+
hashtags
90+
========
91+
92+
<Array> Array of strings, each one representing an hashtag (e.g. #things) in the message.
93+
94+
=====
95+
links
96+
=====
97+
98+
<Array> Array of objects, each one representing a link (both URL and parsed text links) in the message.
99+
100+
.. code-block:: javascript
101+
102+
// URL
103+
{type: 'url', url: 'http://google.com', text: 'http://google.it'}
104+
105+
// Text link
106+
{type: 'link', url: 'http://google.com', text: 'Google'}
107+
108+
=============
109+
text_mentions
110+
=============
111+
112+
<Array> Array of objects, each one representing a text mention (i.e. mentions of users without a nickname) in the
113+
message.
114+
115+
.. code-block:: javascript
116+
117+
{text: 'User', user: <User>}
118+
119+
=====
120+
photo
121+
=====
122+
123+
<Array> Array of :doc:`PhotoSize` objects.
124+
125+
==============
126+
new_chat_photo
127+
==============
128+
129+
<Array> Array of :doc:`PhotoSize` objects.

0 commit comments

Comments
 (0)