DTube IPFS Discord Bot March 2019 Update! Improved file pinning, node stats, usage data command and more!

IPFS Discord Bot March 2019 update.png



General Improvements

It has been over 6 months since the previous update on this bot. So it's time to give some fresh code to make this work more efficiently and give it some new features!

Improved file pinning


Originally all file pinning operations were done entirely with ShellJS. Since then I had switched to the official IPFS Javascript library for file pinning in 0.8.3 update of my 3rd party DTube uploader, there's no reason to not do the same for my IPFS Discord Bot as well.

This code update mainly improves the error handling of pinning operations. In case of any errors, the API will return a proper error message which ShellJS cannot do.

Proper error message if IPFS hash record is not found on Steem


Previously, running any pinning commands for resolutions that simply do not exist as a record on the Steem blockchain, will result in a 404 download error, which could also mean that the video hash for specified resolution exists but failed to download from DTube's servers.

Now, if the specified hash cannot be found in json_metadata of the Steem post, it will send a "record not found" error message to the user in the chat.

Tag spam fix on pin completion


This may not be an issue when only one or two instances of the bot are running at the same time. Since then, @onelovedtube have over 10 IPFS bots running in the Discord server. When a pin is complete, all the bots will tag the user that the pin is complete, effectively spam tagging.

Screenshot 2019-03-19 at 9.35.50 PM.png

So, instead of calling message.reply(), it is now calling message.channel.send() method on pin complete notification, with mention of the author and permlink together with the specified resolution in the notification.

Screenshot 2019-03-19 at 9.38.18 PM.png

Now that looks much less spammy, right? 😉

New features

Now comes what's new in this update!

Usage stats command


Some users would like to check how much storage they're occupying with the videos that they pin. Now, the bot logs disk usage utilization for each pinning command run. And there is a command to check the totalled disk usage data.

It may be run by typing !usage into the chat.

Screenshot 2019-03-19 at 9.46.04 PM.png

Server admins may obtain all user's disk usage data in a RAW JSON file, in a DM by typing !usagels into the chat.

IPFS node stats command


A new command has been added to find out IPFS node stats, such as bandwidth usage, number of pins, peers connected etc, through the bot itself. It may be triggered by !stats command, and the result will look something like this:

Screenshot 2019-03-19 at 9.50.23 PM.png

To filter stats so that it will only show stats for one particular node, either put !usage <nodeID> (where nodeID is a number or string specified in config.json, or the peer ID of the IPFS node, which may be obtained using the !myid command).

Github account


3 columns
2 columns
1 column