Skip to content

Commit 5467458

Browse files
Various documentation fixes.
1 parent 68c3226 commit 5467458

19 files changed

+126
-136
lines changed

docs/api/bot.rst

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ components.
4141
4242
The username of the bot's owner, which will be displayed in the ``/help``
4343
command. This attribute will be sent directly to the user, so if you want
44-
to insert an username be sure to prefix it with ``@``, so the Telegram
44+
to insert a username be sure to prefix it with ``@``, so the Telegram
4545
client will make that text clickable.
4646

4747
.. py:attribute:: before_help
@@ -84,8 +84,7 @@ components.
8484
parameters:
8585

8686
* A ``chat`` parameter with the representation of the chat in which the
87-
message was sent (either an instance of :py:class:`botogram.User` or
88-
:py:class:`botogram.GroupChat`)
87+
message was sent (an instance of :py:class:`botogram.Chat`)
8988
* A ``message`` parameter with the representation of the received
9089
message (an instance of :py:class:`botogram.Message`)
9190

@@ -99,8 +98,7 @@ components.
9998
will be called with two parameters:
10099

101100
* A ``chat`` parameter with the representation of the chat in which the
102-
message was sent (either an instance of :py:class:`botogram.User` or
103-
:py:class:`botogram.GroupChat`)
101+
message was sent (an instance of :py:class:`botogram.Chat`)
104102
* A ``message`` parameter with the representation of the received
105103
message (an instance of :py:class:`botogram.Message`)
106104

@@ -122,9 +120,8 @@ components.
122120
called with two parameters:
123121

124122
* A ``chat`` parameter with the representation of the chat in which the
125-
message was sent (either an instance of :py:class:`botogram.User` or
126-
:py:class:`botogram.GroupChat`)
127-
* A ``message`` parameter witht the representation of the received
123+
message was sent (an instance of :py:class:`botogram.Chat`)
124+
* A ``message`` parameter with the representation of the received
128125
message (an instance of :py:class:`botogram.Message`).
129126

130127
If the function returns ``True``, then the message processing is stopped,
@@ -142,8 +139,7 @@ components.
142139
message. Decorated functions will be called with two parameters:
143140

144141
* A ``chat`` parameter with the representation of the chat in which the
145-
message was sent (either an instance of :py:class:`botogram.User` or
146-
:py:class:`botogram.GroupChat`)
142+
message was sent (an instance of :py:class:`botogram.Chat`)
147143
* A ``message`` parameter with the representation of the received
148144
message (an instance of :py:class:`botogram.Message`)
149145

@@ -164,8 +160,7 @@ components.
164160
be called with two parameters:
165161

166162
* A ``chat`` parameter with the representation of the chat in which the
167-
message was sent (either an instance of :py:class:`botogram.User` or
168-
:py:class:`botogram.GroupChat`)
163+
message was sent (an instance of :py:class:`botogram.Chat`)
169164
* A ``message`` parameter with the representation of the received
170165
message (an instance of :py:class:`botogram.Message`)
171166
* A ``matches`` parameter with a tuple containing the matched groups
@@ -186,8 +181,7 @@ components.
186181
three parameters:
187182

188183
* A ``chat`` parameter with the representation of the chat in which the
189-
message was sent (either an instance of :py:class:`botogram.User` or
190-
:py:class:`botogram.GroupChat`)
184+
message was sent (an instance of :py:class:`botogram.Chat`)
191185
* A ``message`` parameter with the representation of the received
192186
message (an instance of :py:class:`botogram.Message`)
193187
* An ``args`` parameter with the list of parsed arguments

docs/api/channels.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ just want to send messages to a channel, it's better if you use this.
1515
1616
Create a new :py:class:`~botogram.Chat` object which points to the channel.
1717
You need to provide the channel name, prefixed with ``@``, and your bot's
18-
API key. Please refer to the :ref:`channels-preparation <preparations>`
18+
API key. Please refer to the :ref:`channels-preparation`
1919
section if you don't know how to get it.
2020

2121
:param str name: The channel name.

docs/api/components.rst

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ about how to create them in the ":ref:`custom-components`" chapter.
2828
.. py:attribute:: component_name
2929
3030
The name of the component. If you subclass the class in order to create a
31-
custom component, be sure to set it to an appropiate value.
31+
custom component, be sure to set it to an appropriate value.
3232

3333
.. py:method:: add_before_processing_hook(func)
3434
@@ -38,8 +38,7 @@ about how to create them in the ":ref:`custom-components`" chapter.
3838
Provided functions will be called with two parameters:
3939

4040
* A ``chat`` parameter with the representation of the chat in which the
41-
message was sent (either an instance of :py:class:`botogram.User` or
42-
:py:class:`botogram.GroupChat`)
41+
message was sent (an instance of :py:class:`botogram.Chat`)
4342
* A ``message`` parameter with the representation of the received
4443
message (an instance of :py:class:`botogram.Message`)
4544

@@ -55,8 +54,7 @@ about how to create them in the ":ref:`custom-components`" chapter.
5554
will be called with two parameters:
5655

5756
* A ``chat`` parameter with the representation of the chat in which the
58-
message was sent (either an instance of :py:class:`botogram.User` or
59-
:py:class:`botogram.GroupChat`)
57+
message was sent (an instance of :py:class:`botogram.Chat`)
6058
* A ``message`` parameter with the representation of the received
6159
message (an instance of :py:class:`botogram.Message`)
6260

@@ -73,9 +71,8 @@ about how to create them in the ":ref:`custom-components`" chapter.
7371
parameters:
7472

7573
* A ``chat`` parameter with the representation of the chat in which the
76-
message was sent (either an instance of :py:class:`botogram.User` or
77-
:py:class:`botogram.GroupChat`)
78-
* A ``message`` parameter witht the representation of the received
74+
message was sent (an instance of :py:class:`botogram.Chat`)
75+
* A ``message`` parameter with the representation of the received
7976
message (an instance of :py:class:`botogram.Message`).
8077

8178
If the function returns ``True``, then the message processing is stopped,
@@ -94,8 +91,7 @@ about how to create them in the ":ref:`custom-components`" chapter.
9491
message. Provided functions will be called with two parameters:
9592

9693
* A ``chat`` parameter with the representation of the chat in which the
97-
message was sent (either an instance of :py:class:`botogram.User` or
98-
:py:class:`botogram.GroupChat`)
94+
message was sent (an instance of :py:class:`botogram.Chat`)
9995
* A ``message`` parameter with the representation of the received
10096
message (an instance of :py:class:`botogram.Message`)
10197

@@ -117,8 +113,7 @@ about how to create them in the ":ref:`custom-components`" chapter.
117113
be called with three parameters:
118114

119115
* A ``chat`` parameter with the representation of the chat in which the
120-
message was sent (either an instance of :py:class:`botogram.User` or
121-
:py:class:`botogram.GroupChat`)
116+
message was sent (an instance of :py:class:`botogram.Chat`)
122117
* A ``message`` parameter with the representation of the received
123118
message (an instance of :py:class:`botogram.Message`)
124119
* A ``matches`` parameter with a tuple containing the matched groups
@@ -140,8 +135,7 @@ about how to create them in the ":ref:`custom-components`" chapter.
140135
three parameters:
141136

142137
* A ``chat`` parameter with the representation of the chat in which the
143-
message was sent (either an instance of :py:class:`botogram.User` or
144-
:py:class:`botogram.GroupChat`)
138+
message was sent (an instance of :py:class:`botogram.Chat`)
145139
* A ``message`` parameter with the representation of the received
146140
message (an instance of :py:class:`botogram.Message`)
147141
* An ``args`` parameter with the list of parsed arguments

docs/api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
API reference
88
~~~~~~~~~~~~~
99

10-
This section will cover the full reference of the botogram's public API. The
10+
This section will cover the full reference of botogram's public API. The
1111
API will be kept backward compatible for at least the next release, even if
1212
the development will be made trying to not break anything.
1313

docs/api/utility.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ development. Feel free to use them when you need them.
4848
4949
This decorator does nothing currently. If you still use it, just remove all
5050
the references to it in your source code. Your bot will still work
51-
flawlessy.
51+
flawlessly.
5252

5353
.. deprecated:: ae3314ed it will be removed in botogram 1.0
5454

5555
.. py:decorator:: botogram.pass_bot
5656
5757
This decorator does nothing currently. If you still use it, just remove all
5858
the references to it in your source code. Your bot will still work
59-
flawlessy.
59+
flawlessly.
6060

6161
.. deprecated:: ae3314ed it will be removed in botogram 1.0
6262

docs/channels.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The final step is to add your bot as an administrator of the channel. Open your
3131
favourite Telegram client, and go to the administrators' section of your
3232
channel. From it you should add your bot, and then you're ready.
3333

34-
.. _chanels-standalone:
34+
.. _channels-standalone:
3535

3636
=========================
3737
Manage without a full bot
@@ -50,8 +50,8 @@ channel object:
5050
5151
You need to replace ``@my_channel`` with your channel's public name, and
5252
``YOUR_API_KEY`` with the key you got before. Then you can use all the methods
53-
of the :py:class:`~botogram.Chat` object with the instance you got. For
54-
example, if you want to send a text message you should do:
53+
of the :py:class:`~botogram.Chat` object with the instance you are returned.
54+
For example, if you want to send a text message you should do:
5555

5656
.. code-block:: python
5757
:emphasize-lines: 2
@@ -88,3 +88,4 @@ cites botogram in a chat, you can do this:
8888
user = message.from_.username
8989
9090
bot.send("@my_channel", "%s mentioned botogram!" % user)
91+
.. _@botfather: https://telegram.me/botfather

docs/custom-components.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Creating custom components
88
~~~~~~~~~~~~~~~~~~~~~~~~~~
99

1010
Hopefully you'll get to a point when you've made a few bots. The problem is,
11-
there's an high chance parts of the code are duplicate in the bots. For
11+
there's a high chance parts of the code are duplicated between the bots. For
1212
example, if your bots are meant to be used only by some people, you'll have
1313
duplicate code which filters who can interact with the bot.
1414

15-
Components provides an easy and elegant way to solve the problem: instead of
15+
Components provide an easy and elegant way to solve the problem: instead of
1616
copy-pasting the shared code in each bot, they allow you to create isolated
1717
groups of hooks, commands and so on, then you can import and use them in each
1818
bot.
@@ -24,13 +24,15 @@ Components code of conduct
2424
==========================
2525

2626
If you want to distribute your components, you should follow these simple rules
27-
while coding it. This way all components will adhere to the same standars,
27+
while coding them. This way all components will adhere to the same standards,
2828
simplifying the end-user experience:
2929

30-
* **Give appropiate names to your components**. Component names are used to
31-
give the end-user a hint about when that thing was defined. Also, make sure
32-
your name isn't used by someone else, for example adding your nickname as a
33-
prefix.
30+
* **Give appropriate names to your components**. Naming your component
31+
appropriately will help users identify runtime actions involving your
32+
component, such as when the component is loaded into their bot, or if a hook
33+
defined by your component is called (when running in debug mode). Also, to
34+
be sure your component's name isn't used by someone else, consider adding
35+
your nickname as a prefix.
3436

3537
* **Don't assume your component will be used only by one bot**. Try to design
3638
your component in a way it can be used by multiple bots at once. This
@@ -129,7 +131,7 @@ Using a custom component
129131
If you want to use a component you created in your bots, you need to initialize
130132
its object and apply it to each bot you want. We're going to apply the
131133
``myacl`` component we wrote before, which should be in a separated file, to
132-
the hello world you can find in the index of the docs:
134+
the hello world bot you can find in the index of the docs:
133135

134136
.. code-block:: python
135137

docs/deploy/common.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Common deployment information
66
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77

8-
Even if different deployments techniques are *really* different, all of them
8+
Even if different deployment techniques are *really* different, all of them
99
have two essential things in common: server security and application
1010
configuration.
1111

@@ -14,7 +14,7 @@ Server security considerations
1414

1515
In a perfect world, you wouldn't need to worry about securing your servers,
1616
because no one would attempt to break them. Unfortunately, we don't live in
17-
that world, so you need to protect your server from the ones who loves breaking
17+
that world, so you need to protect your server from the ones who love breaking
1818
others' things.
1919

2020
* **You need to have experience in servers management**. Servers aren't easy to
@@ -28,7 +28,7 @@ others' things.
2828
attacker won't be able to do too much damage on your system.
2929

3030
* **Keeping services separated is a good idea**. In order to restrict even more
31-
what an hypothetical attacker can do, you can created a separated user for
31+
what an hypothetical attacker can do, you can create a separate user for
3232
*each* service you have on your server. This way an attacker can't even
3333
compromise other applications.
3434

@@ -46,15 +46,15 @@ traffic (for example bots only for a single group chat) this might become
4646
annoying.
4747

4848
The solution is to run multiple bots in a single runner, since adding bots to a
49-
runner is way more inexpensive instead of creating a runner per bot. Be warned
50-
that if you add too much bots in a single runner, the workers might not be able
49+
runner is way more inexpensive than creating a runner per bot. Be warned
50+
that if you add too many bots to a single runner, the workers might not be able
5151
to keep up with the incoming requests.
5252

53-
In order to make this happening, you need to have each bot in an importable
53+
In order to make this happen, you need to have each bot in an importable
5454
Python file, and then create a file which calls :py:func:`botogram.run` with
5555
the bots' instances. For example, if you have two bots in ``mybot1.py`` and
5656
``mybot2.py``, and the bot instance in all of them is called ``bot``, you can
57-
use this script to run all of them:
57+
use this script to run both of them in a single runner:
5858

5959
.. code-block:: python
6060

docs/deploy/supervisord.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Deploy with Supervisor
77

88
Supervisor_ is a process management system written in Python, which allows you
99
to run applications in a controlled and reliable way. It features running
10-
things in the background, rotation of the log files, and automatically restarts
10+
things in the background, rotation of the log files, and automatic restarts
1111
of crashed applications.
1212

1313
Supervisor is the best choice for deploying botogram-powered bots, since it
@@ -53,7 +53,7 @@ init system.
5353
Preparation of the bot
5454
======================
5555

56-
First thing to do is to create an user which will own the bot. This allows your
56+
First thing to do is to create a user which will own the bot. This allows your
5757
bot to run in isolation from other processes, increasing the security of your
5858
deployment. The user will be called ``telegrambot`` (from **root**)::
5959

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.. Copyright (c) 2015 Pietro Albini <[email protected]>
2-
Released under the MIT licende
2+
Released under the MIT license
33
44
~~~~~~~~~~~~~~~~~~~~~~
55
botogram documentation

0 commit comments

Comments
 (0)