Quick update on DTube IPFS Discord Bot: Now it pins files immediately after downloading!

Repository

https://github.com/techcoderx/DTube-IPFS-Bot


Yesterday, I made a Utopian development post regarding all the new features that has been added to my IPFS bot. For those who haven't see it, make sure you check it out by clicking here.

Referring to the original post that I wrote about the bot, it is not possible to use the js-ipfs-api to pin downloaded files as the ipfs.add method does not support the trickledag (-t) option which is needed in order to obtain the same hash as the hash in the file name of downloaded file. Since I can't execute .bash scripts directly from JavaScript (it's a huge security risk to do so), I was stuck with manual pinning scripts, or having to deal with buggy crontabs.

New feature: Bot now pins files to IPFS node immediately after downloading!

Today, I came across a dependency for NodeJS applications called ShellJS. It's a dependency that allows developers to execute Unix shell commands within a NodeJS application. With this dependency, I was be able to call the exec() method to execute any valid shell commands.

Therefore, I can use this method to pin downloaded files right after it has completed downloading. Firstly, I have to add the downloaded file to IPFS, then in the callback function, I can pin the file that has been added to IPFS. shell.rm method deletes the original downloaded file from disk as the file is already in the IPFS repo after pinning has been done.

Screen Shot 20180910 at 9.29.01 PM.png

To clean up the repository, most script files and pinning queue text files have been deleted as you can see here as manual pinning is no longer needed after ShellJS dependency has been installed to execute pinning scripts right after completing the download.

To finish off, the pre-configured settings has been changed to notify that files have been pinned to IPFS instead of file being added to manual pinning queue.

Screen Shot 20180910 at 8.16.23 PM.png
Note: the above replies have been modified to differentiate between 2 different servers (in a different location) running the same bot.


Demo

This bot has been invited into the following Discord servers so that you can try it out:

  1. OneLoveDTube
  2. Helpie
  3. Nebulus.app

Github account

https://github.com/techcoderx

H2
H3
H4
3 columns
2 columns
1 column
5 Comments
Ecency