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

Commit 2d5dc03

Browse files
committed
Documentation for CallbackQuery, ChatMember, File, InlineQuery, UserProfilePhotos objects
1 parent 4fb01f5 commit 2d5dc03

File tree

8 files changed

+150
-7
lines changed

8 files changed

+150
-7
lines changed

docs/index.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,11 @@ Nodeogram is released under the GNU General Public License 3.0.
7575

7676
objects/Bot
7777
objects/Chat
78-
objects/User
78+
objects/User
79+
objects/Message
80+
objects/CallbackQuery
81+
objects/ChosenInlineResult
82+
objects/ChatMember
83+
objects/File
84+
objects/InlineQuery
85+
objects/UserProfilePhotos

docs/objects/CallbackQuery.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CallbackQuery
2+
=============
3+
4+
This object represents a Telegram callback query.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#callbackquery>`_.
9+
10+
==========================
11+
CallbackQuery(object, bot)
12+
==========================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new CallbackQuery object.
19+
20+
================================
21+
answerCallbackQuery(text, alert)
22+
================================
23+
24+
* ``text`` <String>
25+
* ``alert`` <Boolean> Whether the user should be shown an alert
26+
27+
Answers the query and returns a promise that resolves to the response (according to Telegram, true on success).

docs/objects/ChatMember.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ChatMember
2+
==========
3+
4+
This object represents a Telegram chat member.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#chatmember>`_.
9+
10+
=======================
11+
ChatMember(object, bot)
12+
=======================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new ChatMember object.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ChosenInlineResult
2+
==================
3+
4+
This object represents a Telegram chosen inline query result.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#choseninlineresult>`_.
9+
10+
===============================
11+
ChosenInlineResult(object, bot)
12+
===============================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new ChosenInlineResult object.

docs/objects/File.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
File
2+
====
3+
4+
This object represents a Telegram file.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#file>`_.
9+
10+
=================
11+
File(object, bot)
12+
=================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new File object.
19+
20+
==========
21+
download()
22+
==========
23+
24+
Returns a promise that resolves to a NodeJS `Buffer <https://nodejs.org/api/buffer.html>`_.

docs/objects/InlineQuery.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
InlineQuery
2+
===========
3+
4+
This object represents a Telegram inline query.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#inlinequery>`_.
9+
10+
========================
11+
InlineQuery(object, bot)
12+
========================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new InlineQuery object.
19+
20+
========================
21+
answer(results, options)
22+
========================
23+
24+
* ``results`` <Array> Array of InlineQueryResult
25+
* ``options`` <Object> *Optional*
26+
27+
Answers the inline query with the specified results and returns a promise that resolves to the response (according to
28+
Telegram, true on success).

docs/objects/UserProfilePhotos.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
UserProfilePhotos
2+
=================
3+
4+
This object represents a Telegram user's profile photos.
5+
6+
.. note::
7+
8+
This object inherits some properties from the corresponding `Telegram object <https://core.telegram.org/bots/api#userprofilephotos>`_.
9+
10+
==============================
11+
UserProfilePhotos(object, bot)
12+
==============================
13+
14+
.. warning::
15+
16+
This constructor should be for internal use only.
17+
18+
Creates a new UserProfilePhotos object.
19+
20+
======
21+
photos
22+
======
23+
24+
<Array> Array of arrays of :doc:`PhotoSize` objects.

lib/InlineQuery.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
'use strict';
2-
const User = require('./User.js');
2+
const User = require('./User.js'),
3+
extend = require('util')._extend;
34

45
function InlineQuery(object, bot) {
56
if (object == undefined) return;
7+
extend(this, object);
68

7-
for (var attribute in object) {
8-
if (object.hasOwnProperty(attribute)) {
9-
this[attribute] = object[attribute];
10-
}
11-
}
129
this.bot = bot;
1310
this.from = new User(this.from);
1411

0 commit comments

Comments
 (0)