Skip to content

Commit

Permalink
Removed /photo because /status was basically doing the same thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianonline committed Feb 18, 2016
1 parent c079e86 commit 29c40d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ To allow the plugin to send messages via telegram, you have to register a telegr
* Give your bot a nice profile picture. Send `/setuserpic`, select the bot and send the Octoprint logo.
* Tell the Botfather which commands are available. This enables Telegram to auto-complete commands to your bot. Send `/setcommands`, select the bot and then send this (one message with multiple lines):
```
photo - Sends a current photo.
abort - Aborts the currently running print.
shutup - Disables automatic notifications till the next print ends.
imsorrydontshutup - The opposite of /shutup - Makes the bot talk again.
status - Sends the current status.
status - Sends the current status including a photo.
help - Displays the help
```
* Send a message to your new bot. Any message is okay, Telegram's default `/start` is fine as well.
Expand All @@ -35,12 +34,13 @@ To allow the plugin to send messages via telegram, you have to register a telegr
* Configuration is done via Octoprint's settings dialog.
* Token: Enter your bot token here. You got this from @botfather, when you created your bot there.
* Chat-ID: Which Telegram chat the plugin uses for communication. Commands from other chats are ignored, so you don't have to worry about other people controlling your Octoprint. Known chats (chats that have been active during the time octoprint is running) are listed below - find your chat and copy the ID into this field. If you're missing a chat in the list of known chats, close the settings, send any message to your bot and then re-open the settings. It should now be listed.
* Height change: Whenever the current z value grows by this value (or more), a message will be sent.
* Setting this to 1.0 would send messages at z=1.0, z=2.0, z=3.0 and so on.
* Having this at 1.0 with a layer height of 0.3 would send messages at z=1.2, z=2.4, z=3.6 and so on.
* You can control if you want messages at print start, finish and failure events.
* Send notification every: Whenever the current z value grows by this value (or more) or the given time has passed since the last notification, a message will be sent.
* Setting the height to 1.0mm would send messages at z=1.0, z=2.0, z=3.0 and so on.
* Having the height at 1.0mm with a layer height of 0.3 would send messages at z=1.2, z=2.4, z=3.6 and so on.
* Setting the time or height to `0` disables those checks. Setting both values to `0` completely disables automatic notifications while printing.
* You can set if you want messages at print start, finish and failure events.
* You can change the messages. Usable variables are:
* `{file}` - The currently printing file.
* `{file}` (only usable while printing) - The currently printing file.
* `{z}` (only for height change events) - The current z value.
* `{percent}` (only useful for height change notifications) - The current percentage of the print progress.
* `{time_done}`, `{time_left}` (only useful for height change events) - Time done / left in the print.
Expand Down
7 changes: 2 additions & 5 deletions octoprint_telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ def run(self):
command = message['message']['text']
self._logger.info("Got a command: '" + command + "' in chat " + str(message['message']['chat']['id']))
if self.main._settings.get(['chat'])==str(message['message']['chat']['id']):
if command=="/photo":
self.main.send_msg("Current photo.", with_image=True)
elif command=="/abort":
if command=="/abort":
if self.main._printer.is_printing():
self.main.send_msg("Really abort the currently running print?", responses=["Yes, abort the print!", "No, don't abort the print."])
else:
Expand Down Expand Up @@ -91,11 +89,10 @@ def run(self):
self.main.on_event("TelegramSendNotPrintingStatus", {})
elif command=="/help":
msg = "You can use following commands:\n"
msg+= "/photo - Sends a current photo.\n"
msg+= "/abort - Aborts the currently running print. A confirmation is required.\n"
msg+= "/shutup - Disables automatic notifications till the next print ends.\n"
msg+= "/imsorrydontshutup - The opposite of /shutup - Makes the bot talk again.\n"
msg+= "/status - Sends the current status."
msg+= "/status - Sends the current status including a current photo."
self.main.send_msg(msg)
else:
self._logger.warn("Previous command was from an unknown user.")
Expand Down

0 comments on commit 29c40d5

Please sign in to comment.