STL Viewer is a Discord bot which goal is to generate a preview of a .stl
file when shared in Discord instead of having to download it.
It was developped in Node.js and Typescript using the Discord.js library. The preview image is generated with OpenSCAD.
Right now two options are available:
!stlview
will preview the latest.stl
files uploaded by anyone in the current channel. (This behavior can be seen in the above gif) By default the bot will only look in the last 50 messages.!stlview <discord download link>
If you want to generate a preview for a previous file or for a file from another channel or even from another Discord simply right click the file name and hitCopy link
(and notCopy link message
). If you got it right the link should include the file name at the end.
Sorry, for the moment the bot is still in development and as such I won't provide an invite link. It will be possible once I'm satisfied with it. For the time being you can host it yourself if you really can't wait, see below.
The default configuration can be found in config/default.json
.
If you want to edit or test the bot on your computer you will need Node.js 12+ and Linux (maybe macOS if it handles AppImages).
Then after you've cloned the repository:
npm ci
Create a file named local-development.json
in the config
folder and past your token:
(You can get a token by creating an application and a bot for this application on the developer portal)
{
"token": "INSERT YOUR TOKEN HERE"
}
This file is .gitignored and that will prevent you from sharing it on the internet (which you absolutely should not do).
Then run the bot with
npm run dev
It will reload itself after every saves.
As for local development, create an application on the developer portal. (You don't need a new one if had one for local development).
First create a file named local-production.json
in the config
folder and past your token:
{
"token": "INSERT YOUR TOKEN HERE"
}
Simply run
npm run production
in a tmux
or screen
or use PM2.
- Allow changing the preview orientation
- Support
.3mf
files (and maybe more?) - Improve preview display in Discord
If you miss anything or have any question please open an issue. For now PR are not really welcome as I'm still working on the project but you can still open an issue for us to discuss it.
I'm also available on Discord Outpox#9257
or on the Voron community Discord.