A simple bot to convert files sent to it to URLs to make direct download links.
At first download the program from releases. Then before running the application, set these values as environment variables:
export APP_ID=1234
export APP_HASH=abcd
export BOT_TOKEN=zyxw
export ALLOWED_USERS=1,2
ALLOWED_USERS
is the list of user IDs which are allowed to use the bot. Do not specify this variable in order to make
the bot public.
If you are planning to run this bot on your server you also have to specify these two environment variables:
export LISTEN=0.0.0.0:12345
export URL_PREFIX=my-ip-or-domain:12345
LISTEN
is the listen address of the server. URL_PREFIX
will be as the domain/ip of the links which are sent to
users.
Then simply run the executable file.
To run this app on Heroku, you only need to specify one environment variable other than bot id and app hash/id.
export DYNO_NAME=my-dyno-name
This bot will use a database to store the file information which is mapped from a UUID. By default, bot will use an in memory cache to store these values. This each entry has a TTL of one day by default.
You can change the in memory cache to bbolt in order to make the data persistent on
disk. To enable bbolt, set the environment variable of BOLT_DB_PATH
to a file which is the database.