A Discord bot for Premint.
GET /health
- Health check endpoint, used to keep the bot alive/premint
- Check if a user is in the Premint list/premint <ETH wallet address>
- Check if a user is in the Premint list!premint
- Help!premint-setup
- Check setup status!premint-set-api-key PREMINT_API_KEY
- Set Premint API key!premint-set-role DISCORD_ROLE_ID
- Set Discord role ID!premint-nuke
- Delete all channels & rolesSetup gcloud credentials (only need to do this once):
gcloud iam service-accounts create local-dev
gcloud projects add-iam-policy-binding premint-343516 --member="serviceAccount:local-dev@premint-343516.iam.gserviceaccount.com" --role="roles/owner"
gcloud iam service-accounts keys create credentials.json --iam-account=local-dev@premint-343516.iam.gserviceaccount.com
Never commit or share credentials.json.
Make sure env variables are set in ~/.zprofile
:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials.json"
export PREMINTBOT_DISCORDAUTHTOKEN="REDACTED"
export PREMINTBOT_GOOGLECLOUDPROJECT="premint-343516"
Run the app:
make dev
make test
TODO: Make sure the permissions are correct
Run:
make ship
gcloud run services update premintbot --set-env-vars PREMINTBOT_DISCORDAUTHTOKEN=REDACTED,PREMINTBOT_GOOGLECLOUDPROJECT=premint-343516
https://console.cloud.google.com/firestore/data/guilds?referrer=search&project=premint-343516
Cloud Scheduler link, runs every 5 min: https://console.cloud.google.com/cloudscheduler?project=premint-343516
These events are used for debugging:
guilds.create
When a bot joins the server
Field | Type |
---|---|
GuildID |
string |
GuildName |
string |
GuildAdminRoleID |
string |
OwnerID |
string |
GuildAdmins |
[]string |
Message |
string |
Timestamp |
time.Time |
UserID |
string |
guilds.admin_action
When an admin performs an action
Field | Type |
---|---|
GuildID |
string |
UserID |
string |
Timestamp |
time.Time |
ActionType |
string |
Message |
string |
commands.slash_premint
When someone uses the /premint
command
Field | Type |
---|---|
GuildID |
string |
UserID |
string |
Timestamp |
time.Time |
Registered |
boolean |
WithAddress |
boolean |