Skip to content

Commit

Permalink
feat: i18n, drop legacy commands (#521)
Browse files Browse the repository at this point in the history
Co-authored-by: Tobiah <[email protected]>
Co-authored-by: Jimmy Bot <[email protected]>

fix: tweak day/night algorithm: closes #516
feat: convert genesis to ESM: closes #502
fix: Worldstate commands only use channel-configured platform  #523 
feat: l10n support for localizable commands  #140 

BREAKING CHANGE: Dropped support for node < 14
  • Loading branch information
TobiTenno authored May 9, 2022
1 parent f6f278c commit ccf6bf7
Show file tree
Hide file tree
Showing 371 changed files with 20,153 additions and 21,435 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/gallium
118 changes: 59 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
[![Discord Bots](https://discordbots.org/api/widget/lib/123591822579597315.png)](https://discordbots.org/bot/123591822579597315?utm_source=widget)

## JetBrains
Thank you to [![JetBrains](/src/resources/jetbrains.svg)](https://www.jetbrains.com/) for providing us with free licenses to their great tools.
Thank you to <a href="https://www.jetbrains.com/" alt="JetBrains"><img src="/src/resources/jetbrains.svg"/></a> for providing us with free licenses to their great tools.

* [![WebStorm](/src/rsources/icon-webstorm.svg)](https://www.jetbrains.com/webstorm/)
* <a href="https://www.jetbrains.com/webstorm/" alt="WebStorm"><img src="/src/resources/icon-webstorm.svg"/></a>

Feel free to submit a pull request. We are working on build checks and tests, and we use aribnb's codestyle and eslint configuration. Plugins for auto-linting on save are available for many popular editors.

Expand Down Expand Up @@ -53,82 +53,82 @@ tl;dr Bots need data. While I don't record any of your personal data or save it
Genesis requires a MySQL server. It uses the **MYSQL_*** environment variables for determining where to connect to
### Base
Environment Variable | Description | Example | Default
--- | --- | --- | ---
TOKEN | Discord connection token | `mfa.234089sdfasdf20dfada,f.asd` | N\A
LOG_LEVEL | Logging level of the bot, including info, debug, error, fatal | `DEBUG` | `ERROR`
MYSQL_DB | MySQL database name, used for connecting to data provider and storage | `genesis` | `genesis`
MYSQL_PASSWORD | MySQL database connection password | `password` | N\A
MYSQL_USER | MySQL database connection user | `genesis` | `genesis`
MYSQL_PORT | MySQL database connection port | 3306 | 3306
MYSQL_HOST | Hostname for conneting to MySQL | `localhost` | `localhost`
SHARD_OFFSET | Offset of the first shard id for the local shards, default 0 | 2 | 0
LOCAL_SHARDS | Number of shards locally | 2 | 1
SHARDS | Total number of shards | 1 | 1
OWNER | ID of the person owning/running the bot, used for checking permissions
PREFIX | Default prefix to use for the instance | `\` | `\`
RAVEN_URL | DSN url for logging data to Sentry | `'https://***:***@sentry.io/***'` | N\A
CONTROL_WH_ID | Webhook id for the control webhook for system notifications | '0293485092348490834' | N\A
CONTROL_WH_TOKEN | Webhook token for the control webhook for system notifications | `asdpiofja[ospdj34095u8340wpodfj+_asdf-oja` |N\A
BUG_WH_ID | Webhook id for the bug webhook | '0293485092348490834' | N\A
BUG_WH_TOKEN | Webhook token for the bug webhook | `asdpiofja[ospdj34095u8340wpodfj+_asdf-oja` |N\A
| Environment Variable | Description | Example | Default |
|----------------------|------------------------------------------------------------------------|---------------------------------------------|-------------|
| TOKEN | Discord connection token | `mfa.234089sdfasdf20dfada,f.asd` | N\A |
| LOG_LEVEL | Logging level of the bot, including info, debug, error, fatal | `DEBUG` | `ERROR` |
| MYSQL_DB | MySQL database name, used for connecting to data provider and storage | `genesis` | `genesis` |
| MYSQL_PASSWORD | MySQL database connection password | `password` | N\A |
| MYSQL_USER | MySQL database connection user | `genesis` | `genesis` |
| MYSQL_PORT | MySQL database connection port | 3306 | 3306 |
| MYSQL_HOST | Hostname for conneting to MySQL | `localhost` | `localhost` |
| SHARD_OFFSET | Offset of the first shard id for the local shards, default 0 | 2 | 0 |
| LOCAL_SHARDS | Number of shards locally | 2 | 1 |
| SHARDS | Total number of shards | 1 | 1 |
| OWNER | ID of the person owning/running the bot, used for checking permissions | | |
| PREFIX | Default prefix to use for the instance | `\` | `\` |
| RAVEN_URL | DSN url for logging data to Sentry | `'https://***:***@sentry.io/***'` | N\A |
| CONTROL_WH_ID | Webhook id for the control webhook for system notifications | '0293485092348490834' | N\A |
| CONTROL_WH_TOKEN | Webhook token for the control webhook for system notifications | `asdpiofja[ospdj34095u8340wpodfj+_asdf-oja` | N\A |
| BUG_WH_ID | Webhook id for the bug webhook | '0293485092348490834' | N\A |
| BUG_WH_TOKEN | Webhook token for the bug webhook | `asdpiofja[ospdj34095u8340wpodfj+_asdf-oja` | N\A |
### Stats tracking
Environment Variable | Description | Example | Default
--- | --- | --- | ---
DISCORD_BOTS_WEB_TOKEN | Token used to update bots.discord.pw bot statistics | `as;dofiahsdf` | N\A
DISCORD_BOTS_WEB_USER | Bot user id on bots.discord.pw to update with server count | 6456514654966321321 | N\A
DISCORD_CARBON_TOKEN | Carbonitex bot token for posting server data to Carbonitex | `as;dofiahsdf` | N\A
| Environment Variable | Description | Example | Default |
|------------------------|------------------------------------------------------------|---------------------|---------|
| DISCORD_BOTS_WEB_TOKEN | Token used to update bots.discord.pw bot statistics | `as;dofiahsdf` | N\A |
| DISCORD_BOTS_WEB_USER | Bot user id on bots.discord.pw to update with server count | 6456514654966321321 | N\A |
| DISCORD_CARBON_TOKEN | Carbonitex bot token for posting server data to Carbonitex | `as;dofiahsdf` | N\A |
### Flair configuration
Environment Variable | Description | Example | Default
--- | --- | --- | ---
EMBED_URL | Default link that embeds use in their title | `https://warframestat.us` | `https://warframestat.us`
EMBED_ICON_URL | Default icon URL that embeds use in their footer | `https://warframestat.us/wfcd_logo_color.png` | `https://warframestat.us/wfcd_logo_color.png`
BASE_PRES_MSG | Default presence message | `@Bot help` | `@Bot help`
BASE_PRES_ACT | Default presence activity. Must be a valid discord.js value | `WATCHING` | `PLAYING`
| Environment Variable | Description | Example | Default |
|----------------------|-------------------------------------------------------------|-----------------------------------------------|-----------------------------------------------|
| EMBED_URL | Default link that embeds use in their title | `https://warframestat.us` | `https://warframestat.us` |
| EMBED_ICON_URL | Default icon URL that embeds use in their footer | `https://warframestat.us/wfcd_logo_color.png` | `https://warframestat.us/wfcd_logo_color.png` |
| BASE_PRES_MSG | Default presence message | `@Bot help` | `@Bot help` |
| BASE_PRES_ACT | Default presence activity. Must be a valid discord.js value | `WATCHING` | `PLAYING` |
### Feature Flags
Environment Variable | Description | Example | Default
--- | --- | --- | ---
GAMES | Feature flags to enable | `WARFRAME,UTIL,LOGGING` | `CORE`
| Environment Variable | Description | Example | Default |
|----------------------|-------------------------|-------------------------|---------|
| GAMES | Feature flags to enable | `WARFRAME,UTIL,LOGGING` | `CORE` |
* `CORE` does not need to be specified ever, it will always load
Flag | Feature | Default
--- | --- | ---
CORE | Core features of the bot | ✓
UTIL | Common utility functions that are domain agnostic, such as LFG and builds | ✗
LOGGING | Just what it sounds like, logging guild actions | ✗
CODES | Managing promo codes, like Warframe Glyph codes | ✗
FUN | Fun stuff, like 8Ball and corgis | ✗
WARFRAME | Warframe functionality, like tracking and Warframe informational Commands | ✗
DESTINY2 | For an in-progress section allowing people to expand Genesis into Destiny 2 | ✗
GIVEAWAYS | Giveaway functionality | ✗
CUST_CMDS | Custom commands - user-generated simple commands | ✗
ROOMS | Automated & manual room creation | ✗
BLOCK | Enable user disable features | ✗
CMD_MGMT | Command management | ✗
BOT_MGMT | Bot Management | ✗
| Flag | Feature | Default |
|-----------|-----------------------------------------------------------------------------|---------|
| CORE | Core features of the bot | ✓ |
| UTIL | Common utility functions that are domain agnostic, such as LFG and builds | ✗ |
| LOGGING | Just what it sounds like, logging guild actions | ✗ |
| CODES | Managing promo codes, like Warframe Glyph codes | ✗ |
| FUN | Fun stuff, like 8Ball and corgis | ✗ |
| WARFRAME | Warframe functionality, like tracking and Warframe informational Commands | ✗ |
| DESTINY2 | For an in-progress section allowing people to expand Genesis into Destiny 2 | ✗ |
| GIVEAWAYS | Giveaway functionality | ✗ |
| CUST_CMDS | Custom commands - user-generated simple commands | ✗ |
| ROOMS | Automated & manual room creation | ✗ |
| BLOCK | Enable user disable features | ✗ |
| CMD_MGMT | Command management | ✗ |
| BOT_MGMT | Bot Management | ✗ |
### Setting up Twitch
Environment Variable | Description | Example | Default
--- | --- | --- | ---
TWITCH_CLIENT_ID | Twitch Client ID for querying Twitch API | uo6dggojyb8d6soh92zknwmi5ej1q2 | N/A
TWITCH_USER_LOGIN | The Twitch user login to watch | warframe | warframe
TWITCH_POLL_INTERVAL_MS | How often to poll Twitch for stream updates (in milliseconds) | 10000 | 10000
| Environment Variable | Description | Example | Default |
|-------------------------|---------------------------------------------------------------|--------------------------------|----------|
| TWITCH_CLIENT_ID | Twitch Client ID for querying Twitch API | uo6dggojyb8d6soh92zknwmi5ej1q2 | N/A |
| TWITCH_USER_LOGIN | The Twitch user login to watch | warframe | warframe |
| TWITCH_POLL_INTERVAL_MS | How often to poll Twitch for stream updates (in milliseconds) | 10000 | 10000 |
In order to setup Twitch you need to specify your Twitch API Client ID. See the following link on how to get one:
* Twitch API Client ID: https://dev.twitch.tv/docs/v5/ (See Getting a client ID)
### Other Features
Environment Variable | Description | Example | Default
--- | --- | --- | ---
LFG_ACTIVE_COLOR | Hex color as a string for an active LFG embed | `"0xaf01ff"` | `"0x9370db"`
LFG_EXPIRED_COLOR | Hex color as a string for an expired LFG embed | `"0xff0000"` | `"0xff0000"`
| Environment Variable | Description | Example | Default |
|----------------------|------------------------------------------------|--------------|--------------|
| LFG_ACTIVE_COLOR | Hex color as a string for an active LFG embed | `"0xaf01ff"` | `"0x9370db"` |
| LFG_EXPIRED_COLOR | Hex color as a string for an expired LFG embed | `"0xff0000"` | `"0xff0000"` |
## Commands
Expand Down
2 changes: 2 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
files:
- source: /src/resources/locales/en.json
translation: /src/resources/locales/%two_letters_code%.json
- source: /src/resources/locales/commands/en.js
translation: /src/resources/locales/commands/%two_letters_code%.js
26 changes: 10 additions & 16 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
'use strict';

const genManifest = require('./src/tools/generateManifest.js');
const Genesis = require('./src/bot');
import Genesis from './src/bot.js';

const localShards = parseInt(process.env.LOCAL_SHARDS, 10) || 1;
const shardOffset = parseInt(process.env.SHARD_OFFSET, 10) || 0;

genManifest();
const commandManifest = require('./commands.json');

const shards = new Array(localShards)
.fill(0, 0, localShards + 1)
.map((val, index) => index + shardOffset);
const shards = new Array(localShards).fill(0, 0, localShards + 1).map((val, index) => index + shardOffset);

new Genesis(process.env.TOKEN, {
prefix: process.env.PREFIX,
owner: process.env.OWNER,
commandManifest,
shards,
}).start();
(async () => {
const genesis = await new Genesis(process.env.TOKEN, {
prefix: process.env.PREFIX,
owner: process.env.OWNER,
shards,
});
await genesis.start();
})();
Loading

0 comments on commit ccf6bf7

Please sign in to comment.