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 & roles
Setup 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:[email protected]" --role="roles/owner"
gcloud iam service-accounts keys create credentials.json [email protected]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 devmake testTODO: Make sure the permissions are correct
Run:
make shipgcloud run services update premintbot --set-env-vars PREMINTBOT_DISCORDAUTHTOKEN=REDACTED,PREMINTBOT_GOOGLECLOUDPROJECT=premint-343516https://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:
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 |
When an admin performs an action
| Field | Type |
|---|---|
GuildID |
string |
UserID |
string |
Timestamp |
time.Time |
ActionType |
string |
Message |
string |
When someone uses the /premint command
| Field | Type |
|---|---|
GuildID |
string |
UserID |
string |
Timestamp |
time.Time |
Registered |
boolean |
WithAddress |
boolean |