Skip to content

Commit ca6ba78

Browse files
committed
Fix docs code typos and deprecated code
Replace bot.send(chat, message) with bot.chat(chat).send(message) Fix typos in the buttons code
1 parent 78679b7 commit ca6ba78

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

docs/api/bot.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ components.
344344
345345
@bot.timer(1)
346346
def spammer(bot):
347-
bot.send(USER_ID, "Hey!")
347+
bot.chat(USER_ID).send("Hey!")
348348
349349
:param int interval: The execution interval, in seconds.
350350

docs/api/buttons.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ information about them.
3434
btns = botogram.Buttons()
3535
btns[0].url("Visit example.com", "http://www.example.com")
3636
btns[1].url("example.net", "http://www.example.net")
37-
btns[1].url("example.org", "http://www.example.org")
37+
btns[2].url("example.org", "http://www.example.org")
3838
3939
chat.send("Check out some example sites!", attach=btns)
4040
@@ -71,7 +71,7 @@ information about them.
7171
7272
btns = botogram.Buttons()
7373
btns[0].callback("Commit changes", "commit")
74-
btns[0].callback("Checkout master", "checkout", "master")
74+
btns[1].callback("Checkout master", "checkout", "master")
7575
7676
:param str label: The label of the button shown to the user
7777
:param str callback: The internal name of the callback

docs/tasks.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ implement this, with a resolution of one second. Just use the
3939
@bot.timer(3600)
4040
def BONG(bot, shared):
4141
for chat in shared["subs"]:
42-
bot.send(chat, "BONG")
42+
bot.chat(chat).send("BONG")
4343
4444
If you're working with components, you can instead use the
4545
:py:meth:`~botogram.Component.add_timer` method of the component instance.

docs/unavailable-chats.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ can take action without aborting the update processing:
105105
106106
for user in users:
107107
try:
108-
bot.send(user, message)
108+
bot.chat(user).send(message)
109109
except botogram.ChatUnavailableError as e:
110110
print("Can't send messages to %s (reason: %s)" %
111111
(e.chat_id, e.reason))

0 commit comments

Comments
 (0)