A Discord bot that logs user emoji usage.
Be aware that while the Google Sheets API has a free tier, it has limits in place. You can read more about the API limits here and the document limits here.
Given that a Google Sheets document supports up to 5000000 cells and the main
logs
table has 5 columns, that gives us appromixately 1000000 rows. If we assume a rate of 500 logs per day, that gives us approximately 5.5 years before we have to consider archiving rows.
-
Follow the setup instructions found in the project google-spreadsheet to create a Google Sheets API Service Account.
Take note of the client email associated with the Service Account. Additionally, you will have downloaded a credentials JSON file after following through the instructions. You will need these in the next section.
-
Create a Google Sheets document in your Google Drive.
-
Click the green
Share
button and share the file with the client email associated with the Service Account.Make sure the Service Account has edit access to this file or the bot will not be able to log data!
-
Follow the instructions in create-discord-bot.
-
Copy the
client_email
andprivate_key
values in the credentials JSON file into your.env
file:CLIENT_EMAIL=client_email_value_here PRIVATE_KEY=private_key_value_here
-
Download this widget and move the
src-discord-emoji-log-bot
folder into the src/widgets/ folder created in step 1.npm i -s emoji-regex@^9.2.2 google-spreadsheet@^^3.1.15
to install this widget's dependencies. -
Open config.js to configure your own settings:
module.exports = { sheetId: "1CrvJ3Zuec5F7dF5ez_nPOJ5auZVfPrXz_W8GG2o0PZM", guildChannelMap: { "258167954913361930": { channelsToIgnore: [], }, }, };
Add as many rules as you want to configure for other servers.
sheetId
is the id of the Google Sheets document found in the URL: https://docs.google.com/spreadsheets/d/SHEET_ID_FOUND_HERE/edit.guildChannelMap
is a key-value map between server id and channel ids.channelsToIgnore
are the text channel ids the bot will not log user emoji usage from.
-
npm start
to run the bot.
Visit for more help or information!