Discord bot written in Node.js (using discord.js) for HammerTime
$ sudo npm install -g pm2
$ npm install
$ cp .env.example .env
$ nano .env # Fill in the neccessary environment variables
$ npm build
$ pm2 start pm2.json
src/webhook.ts is the bot's only entry point (npm start/pm2.json's HammerTimeBot:Webhook) -
it receives interactions over Discord's HTTP Interactions Endpoint rather than a gateway connection,
so there's no ShardingManager/gateway mode to speak of. Setting an Interactions Endpoint URL on the
application in the Discord Developer Portal is what actually switches interaction delivery over -
once set, Discord stops sending INTERACTION_CREATE over the gateway entirely for that application,
which is why this needs to be a real HTTP server rather than something that only starts reacting once
you're sure: there's no dual-running fallback. Don't set that URL against production until you're
confident in the webhook path (test it against a dev subdomain / secondary application first).
One-time production server setup:
deploy/nginx/→ symlink the config into/etc/nginx/sites-available/and/etc/nginx/sites-enabled/, matching how this project's other nginx configs are laid out on that host.- Expand (or issue) a cert covering the webhook subdomain, e.g. via
certbot --expand. sudo nginx -t && sudo systemctl reload nginx- Set
DISCORD_PUBLIC_KEY(the app's Ed25519 public key, from the Developer Portal),WEBHOOK_PATH_SECRET(a long random URL-safe token - see its doc comment insrc/env.tsfor how to generate one), and optionallyWEBHOOK_PORT(defaults to3939) in the server's.env. pm2 start pm2.json(orpm2 restart pm2.jsonif already running) to bring upHammerTimeBot:Webhook.- Once confident locally/in staging, set the Interactions Endpoint URL to
https://<webhook subdomain>/<WEBHOOK_PATH_SECRET>in the Developer Portal - this is the actual cutover step (see above). The endpoint only serves interactions at that secret path (anything else, including/, 404s) so scanner/health-check noise never reaches signature verification.
New language contributions are welcome! They are handled through Crowdin. If you don't see your language listed, that means it's likely not supported by the Discord client itself, meaning translations would be pointless. If a language is available in Discord's settings but is not listed on Crowdin, or you want to help with the translations of an existing language, please join our Discord server and ask for your language to be added to the project in the #translator-signup channel. You will be given the Translator role and granted access to a language-specific channel for further discussion. This is necessary so that when new translations are needed for any potential new bot features, I have an easy way to reach everyone at once.
English and Hungarian translations have been included, so no translators will be needed for these two languages.
- 🇧🇬 Bulgarian
- 🇨🇳 Chinese Simplified
- 🇹🇼 ChineseTW
- 🇭🇷 Croatian: Volvone
- 🇨🇿 Czech
- 🇳🇱 Dutch: Jesse
- 🇫🇮 Finnish: nicohele
- 🇫🇷 French
- 🇩🇪 German
- 🇬🇷 Greek: Belle Bernice
- 🇮🇳 Hindi: Balajiasli
- 🇮🇩 Indonesian: Jackie
- 🇮🇹 Italian: RVG|𝓵𝓸𝓻𝔂
- 🇯🇵 Japanese
- 🇰🇷 Korean
- 🇱🇹 Lithuanian: Trent
- 🇳🇴 Norwegian
- 🇵🇱 Polish
- 🇧🇷 Portuguese, Brazilian
- 🇷🇴 Romanian
- 🇷🇺 Russian
- 🇪🇸 Spanish
- 🇲🇽 Spanish, Latin America
- 🇹🇭 Thai
- 🇹🇷 Turkish
- 🇺🇦 Ukrainian
- 🇻🇳 Vietnamese