Duet Telegram Bot
This bot is inspired by Octoprint-Telegram
sudo npm i -g duet-telegram
Start the bot by typing the command
The first time you start it won't find any configuration, you will prompted to create an example configuration file.
Edit the configuration file (you can ignore
authorizedUsers unless you know your telegram user id, see next step) and start the bot again.
First time authorization
Start a conversation with your bot in telegram and hit the start button, this will issue the command
If you didn't know your telegram user id, this will now be logged in the console output for `duetbot.
Stop the bot and add your telegram user id in the confiuration file
authorizedUsers and restart the bot.
You are now all set to start using the bot.
Install NodeJS on Raspberry
sudo apt-get install curl curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs
Create Telegram Bot
Open a chat with @botfather in Telegram Messenger.
/newbotto @botfather and follow the instructions.
The botfather gives you a token, which you will need to use in the configuration for this software later on.
Send the available commands to botfather to enable auto-complete in the bot. Send
/setcommandsto botfather and select your created bot. Paste the commands in the box below (one message with multiple lines).
status - Display current print status. upload - Upload gcode file. files - Browse gcode files. print - Alias for files. macros - Browse macros. togglepause - Pause/resume print. notifications - Show/Change your notification settings. cancel - Cancel paused print. gcode - Send gcode to printer. emergencystop - A confirmation is required. shutup - Disables all automatic notifications. dontshutup - Enables all automatic notifications. help - Show this help message.
Changing notification settings
All chats notification settings are available in the file
<HOME DIR>/.duetbotdb.json, you can modify this file to change your settings. You will need to restart the bot for the configuration to be in effect.
There is plans on adding configuration support through the bot for this. See TODO
- Add support for password protected duet
- Support paginated file listing responses
- Respect sessionTimeout from rr_connect
- Test pause / resume with print interval notifications
- use telgram.sendChatAction for commands that takes time to process
Some console / response message may be lost.
Apparently the data returned by
rr_reply are flushed from duet, which means if duet web control is running it might fetch them before the bot does or vice versa.
Response from gcode commands requires console notifications enabled to see them.