You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: docs/objects/Bot.rst
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,4 +237,41 @@ This object represents a Telegram bot.
237
237
:param string filter: Must be one of the following: ``private``, ``group``, ``supergroup``, ``channel`` or ``all``. Can also be a function that accepts one argument (a :doc:`Chat` object without functions) and returns a boolean value
238
238
:param function callback: A function to which is provided a single argument, a promise that resolves to a :doc:`Chat` object.
239
239
240
-
Iterates a function through all of chats stored in the profiles storage.
240
+
Iterates a function through all of chats stored in the profiles storage.
241
+
242
+
.. js:function::form(user_id, object, callback)
243
+
244
+
:param string user_id: Can also be a :doc:`Chat` or a :doc:`User` object. **It must be a private chat!**
245
+
:param object object: The form object (see below).
246
+
:param function callback: A function that accept one argument
247
+
248
+
Creates a form for a user. The ``object`` argument must follow this format:
249
+
250
+
.. code-block:: javascript
251
+
252
+
{name: {
253
+
message: {
254
+
text:'Please enter your name',
255
+
options: {}
256
+
},
257
+
regex:/([A-Z]){1,20}/,
258
+
error: {
259
+
text:'Your name must be between 1 and 20 letters long and must contain only letters',
260
+
options: {}
261
+
}
262
+
},
263
+
surname: {
264
+
message: {
265
+
text:'Please enter your surname',
266
+
options: {}
267
+
},
268
+
regex:/([A-Z]){1,20}/,
269
+
error: {
270
+
text:'Your surname must be between 1 and 20 letters long and must contain only letters',
271
+
options: {}
272
+
}
273
+
}
274
+
275
+
.. js:function::removeForm(user_id)
276
+
277
+
:param string user_id: Can also be a :doc:`Chat` or a :doc:`User` object. **It must be a private chat!**
0 commit comments