Discord plugin for OctoPrint
Branch: master
Clone or download
Pull request Compare This branch is 269 commits ahead, 3 commits behind bchanudet:master.
Latest commit a454659 Feb 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Added coverage script and added it to circle ci run #40 Aug 13, 2018
.vscode Include discord module and vscode configuration page Aug 26, 2017
extras DR-1: Replaced nasty tabs with precious spaces. Additional renaming of May 16, 2018
octoprint_discordremote Fix #62 Prevent duplicate progress notifications Feb 21, 2019
testconfig DR-41 Added system commands to default config, helps with testing Aug 30, 2018
translations modify identifier, set the plugin as configurable, and include snapsh… Aug 27, 2017
unittests Fix #48: Added time spent and time remaining to status messages Oct 9, 2018
.bumpversion.cfg Update .bumpversion.cfg Feb 12, 2019
.editorconfig DR-1: Removed tabs in python files, REJOICE! May 15, 2018
.gitignore Added coverage script and added it to circle ci run #40 Aug 13, 2018
DiscordRemote.md DR-1: Replaced nasty tabs with precious spaces. Additional renaming of May 16, 2018
LICENSE Finalization. Start of documentation Sep 3, 2017
MANIFEST.in DR-1 Renamed files so that everything is distinct from OctoRant. May 15, 2018
README.md Fix #48: Added time spent and time remaining to status messages Oct 9, 2018
babel.cfg Initial commit of OctoRant Aug 19, 2017
config.yaml.sample DR-1: Moved comfig.yaml to config.yaml.sample May 16, 2018
configtest.py DR-1: Added missing script to configure configtest.py May 16, 2018
kill.sh DR-10 Added kill script to kill hung octoprint instance. Jun 12, 2018
release.sh Added script to assist with bumping version for releases. Oct 9, 2018
requirements.txt Fix #49 ipgetter was removed from pypi, so packaging it up internally. Oct 15, 2018
setup.py Update setup.py Feb 12, 2019
test.bat DR-17 Fixed test.bat to work correctly. Jul 2, 2018
test.sh Fix #51 Send snapshot seperately to notification, as discord mobile n… Oct 25, 2018

README.md

OctoPrint-DiscordRemote

DiscordRemote is a plugin allowing Octoprint to send notifications to a Discord channel via a discord bot. It also listens on the channel and can accept commands to control the printer. This is forked from https://github.com/bchanudet/OctoPrint-Octorant.

License : MIT

Credits

Benjamin Chanudet for their initial plugin, which this is based on.

OctopusProteins for their work on the enclosure plugin, and file upload capabilities.

Changelog

See the release history to get a quick summary of what's new in the latest versions.

Setup

Install the plugin

Install via the bundled Plugin Manager or manually using this URL:

https://github.com/cameroncros/OctoPrint-DiscordRemote/archive/master.zip

Create the Discord Bot in Discord

See the following link for instructions on how to setup a Discord bot and get the Channel ID:

https://github.com/Chikachi/DiscordIntegration/wiki/How-to-get-a-token-and-channel-ID-for-Discord

Commands

To get a list of available commands and arguments, type /help into the discord channel. The bot will return all available commands. Commands can also be sent via the web interface, by clicking the button in the top panel that looks like a game controller.

Configuration

The plugin can be configured in the configuration panel, under the "DiscordRemote" panel.

Discord Settings

  • Bot Token: The token for a discord bot.
  • Channel ID: The ID of a channel the bot will listen and post to. Ensure that this is locked down so that strangers cannot send commands to your printer, or whitelist users using the "Allowed Users" setting.
  • Allowed Users: A whitelist of the users that are allowed to interact with. The bot will only respond if the users ID (Not user name) is in this list.

In order for you to be sure these settings work, every time you change one of them, a test message will be sent to the corresponding Discord Channel. If you don't receive it, something is most likely wrong!

Message Settings

Here you can customize every message handled by DiscordRemote.

  • Toggle the message : by unchecking the checkbox in front of the message title, you can disable the message. It won't be sent to Discord.
  • Message : you can change the default content here. See the section Message format for more information.
  • Include snapshot : if you have a snapshot URL defined in the Octoprint settings, you can choose to upload a snapshot with the message to Discord.
  • Notify every XX% : specific to the printing progress message, this settings allows you to change the frequency of the notification :
    • 10% means you'll receive a message at 10%, 20%, 30%, 40% ... 80%, 90% of the printing process.
    • 5% means you'll receive a message at 5%, 10%, 15%, 20% ... 80%, 85%, 90%, 95% of the printing process.
    • etc...
  • Timeout : for small prints, prevents discord spam by only sending progress messages after the timeout has passed since the previous message.

Message format

Messages are regular Discord messages, which means you can use :

  • **markdown** format (see Discord Documentation)
  • :emoji: shortcuts to display emojis
  • @mentions to notify someone

Some events also support variables, here is a basic list : Common :

  • {ipaddr} : the internal IP address of the OctoPrint server
  • {externaddr} : the external IP address of the OctoPrint server
  • {timeremaining} : the time remaining for the print ('Unknown' if the print is not running)
  • {timespent} : the time spent so far on the print

Printing process : started event :

  • {name} : file's name that's being printed
  • {path} : file's path within its origin location
  • {origin} : the origin storage location

Printing process : failed event :

  • {name} : file's name that's being printed
  • {path} : file's path within its origin location
  • {origin} : the origin storage location

Printing process : done event :

  • {name} : file's name that's being printed
  • {path} : file's path within its origin location
  • {origin} : the origin storage location
  • {time}: time needed for the print (in seconds)
  • {time_formatted} : same as {time}, but in a human-readable format (HH:MM:SS)

Printing process : failed event :

  • {name} : file's name that's being printed
  • {path} : file's path within its origin location
  • {origin} : the origin storage location
  • {position}: position of the hotend

Printing process : paused event :

  • {name} : file's name that's being printed
  • {path} : file's path within its origin location
  • {origin} : the origin storage location
  • {position}: position of the hotend

Printing process : resumed event :

  • {name} : file's name that's being printed
  • {path} : file's path within its origin location
  • {origin} : the origin storage location
  • {position}: position of the hotend

Printing progress event :

  • {progress} : progress in % of the print.

Printer state : error

  • {error} : The error received

For more reference, you can go to the Octoprint documentation on Events

Issues and Help

If you encounter any trouble don't hesitate to open an issue. I'll gladly do my best to help you setup this plugin.