Discord bot that manages user currency with a google spreadsheet database.
-
Setup your Google Spreadsheets Database
- Go to https://console.developers.google.com/
- Create a new project and select ENABLE APIS AND SERVICES
- Select Google spreadsheets and setup your credentials
- You'll receive a .json file which you'll need to put with your project files (You can rename it to client_secret.json)
- If you don't get a .json file, select the service account from the account listing.
- Go to the keys tab and click Add Key --> Create Key --> JSON
- Create a new google spreadsheets doc
- Share your doc with your client_email found in your client_secret.json
- Set your table headers as these:
-
Create a .env file and set these variables:
- Your Discord Bot Login Token
TOKEN=<Discord_Login_Token>
- Your Google Spreadsheet Token
SHEET_TOKEN=<Google_Sheets_Token>
- Example:
- Your Discord Bot Login Token
-
Running the bot
npm install
node index.js
- Which API are you using?
- Google Sheets API
- Where will you be calling the API from?
- Web server
- What data will you be accessing?
- Application Data
- Are you planning to use this API with App Engine or Compute Engine?
- No
- Create your own service account name
- Role should be: Editor
- If asked for key type select: JSON
- Don't fill out Optional
- Create Credential
- Dotenv(https://www.npmjs.com/package/dotenv)
- google-spreadsheet(https://www.npmjs.com/package/google-spreadsheet)
- Discord.js(https://discord.js.org/#/)
Command | Description |
---|---|
!add @user... [optional] <currency_amt> |
Adds one/multiple users to the google spreadsheets database |
!list @user... / !list all |
shows a specific user's or everyone's wallet |
!remove @user |
Removes a user from the database |
!transfer @user... <amount> |
Transfers money from your wallet to one/multiple users |
!update @user... <currency_amt> |
change one/multiple user's currency amt |
!wallet |
shows how much you have in your wallet |
*User is a placeholder for your discord username
- Database Example
- Bank
- Wallet
# Command Help
if message.content.startswith(';help ronin-add'):
embedVarronin = discord.embed(title="For ;ronin-add 0x", color=0xFF10F0)
embedVarronin.add_field(name="[Ronin address]", value='1. Copy your Ronin address without "RONIN:" content\n2. Paste it beside 0x without space',inline=False)
embedVarronin.add_field(name="[Share percentage]", value="Look for your share percentage (usually '65%' in TTB)", inline=False)
embedVarronin.add_image(url="https://i.imgur.com/VM5GyYt.png")
await message.channel.send(embed=embedVarronin)