This code is based off the modular (and not secure) ERC20 Tip Bot here. This one does not claim to be modular, yet it should be easy to modify this bot to work off other databases or coin APIs.
To install the bot:
- If the coin is BTC based:
- Install your 'BTCd'.
- Edit the conf file to add
server=1,rpcuser=user, andrpcpass=pass(with your own username and password). - Start the daemon.
- Move
btcSettings.jsontosettings.json. - Edit the
settings.jsonfile'scoinvar to have:typeset to"BTC".symbolset to the coin's symbol ("BTC").decimalsset to the amount of the coin's decimals (8). Optionally, you may set a lower amount of decimals so users can't tip satoshis.portset to the daemon's RPC port (8337).userset to the username you set in the conf file ("user").passset to the password you set in the conf file ("pass").
- If the coin is an ERC20:
- Install
geth. - Run
geth --syncmode "light"to start Geth with light sync on. - Move
erc20Settings.jsontosettings.json. - Edit the
settings.jsonfile'scoinvar to have:typeset to"erc20".symbolset to the coin's symbol ("ERC").decimalsset to the amount of the coin's decimals (18).ipcset to Geth's IPC file's path ("/home/user/.ethereum/geth.ipc").
- Edit the
settings.jsonfile'scoin.addressesvar to have:walletset to an account address on the Geth node, with a password of "", that will host all the Ether used to fund TXs.contractset to the ERC20's contract address.
- Install
- Install MySQL.
- Create a database.
- Create a table with
name VARCHAR(64), address VARCHAR(64), balance VARCHAR(64), notify tinyint(1). - Edit the
settings.jsonfile'smysqlvar to have:dbset to the name of the database you made for the bot.tableset to the name of the table you made for the bot.userset to the name of a MySQL user with access to the DB.passset to the password of that MySQL user.
- Create a Discord Bot User.
- Go to https://discordapp.com/developers/applications/me.
- Click
New App. - Enter a name, and optionally, upload an icon.
- Click
Create a Bot User. - Grab the
Client IDfrom the top, and go to this link: https://discordapp.com/oauth2/authorize?client_id=!!CLIENT_ID!!&scope=bot&permissions=68672, after replacing !!CLIENT_ID!! with the bot's client ID. This will allow you to add the bot to a server with the proper permissions of Read Messages/Send Messages/Add Reactions (the last one is only necessary if you use giveaways). - Edit the
settings.jsonfile'sdiscordvar to include:tokenset to the bot user token. This is not the client user.userset to the value gotten by right-clicking the bot on your server and clickingCopy ID. This requiresDeveloper Modeto be enabled on your Discord client.
- Set up pools. Either delete or modify the ones in settings.json.
adminscontrol who can add/remove members.membersis anyone who can spend the money in the pool.
- Set up any channel locked commands in
settings.json'scommandsvar.- If you wish to lock a command to a channel, edit
exampleto be the name of the command, andROOM IDto be the value gotten from right-clicking a room and clickingCopy ID. You can add multiple channel IDs to the array. - To setup more channel locks, simply copy the
exampletemplate and fill it our properly.
- If you wish to lock a command to a channel, edit
- Install NodeJS dependencies via
npm i.
All pools must be created via settings.json. All edits to the list of admins must also be done there. Members can be added and removed with !pool NAME add @USER and !pool NAME remove @USER, where NAME is the name of the pool, and @USER is a ping of the Discord user. To send from a pool, use !tip POOL @USER AMOUNT.
There is also a giveaway command to run giveaways with. If you don't want it, either don't setup the giveaways pool or comment out the line that loads it in main.js. To use it, run !giveaway Ts Ww A, where T is the time in seconds (or use "m" as a suffix for minutes), W is the amount of winners, and A is the amount each win. The amount will come from the giveaways pool and be tipped out to the winners.
Neither of these commands are documented as they are only to be used by whoever runs the bot, and that is not most people. It's not for security via obscurity, but rather because a long help file where half the commands aren't needed is annoying.
Want to donate? 0xA0F7aAAF3161c5611a904263bFfe45C92394Da44