Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions server/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Defaults to 0.0.0.0 (listen on all interfaces)
HTTP_HOST=

HTTP_PORT=12369

# Comma-separated list of bearer tokens that are allowed to interact with the API
AUTH_TOKENS=

# CORS allowed origins - defaults to * - see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
CORS_ORIGIN=
38 changes: 38 additions & 0 deletions server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
root: true,
env: {
"commonjs": true,
"es2021": true,
"node": true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: [
"@typescript-eslint",
],
ignorePatterns: [
"out/**",
"test.*",
],
rules: {
"quotes": [ "error" , "double" ],
"semi": [ "error" , "always" ],
"comma-dangle": [ "error" , "always-multiline" ],
"array-bracket-newline": [ "error", "consistent" ],
"function-paren-newline": [ "error", "multiline" ],
"no-control-regex": ["off"],
"eol-last": [ "error", "always" ],
"no-async-promise-executor": "off",
// see https://github.com/eslint/eslint/issues/14538#issuecomment-862280037
"indent": ["error", 4, { "ignoredNodes": ["VariableDeclaration[declarations.length=0]"] }],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "ignoreRestSiblings": true, "argsIgnorePattern": "^_" }],
},
};
661 changes: 661 additions & 0 deletions server/LICENSE.txt

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## BrewBot API
#### Express-based REST API to interface with [BrewBot](https://github.com/codedrunks/BrewBot)

<br>

## Resources
- [Guild](#guild)
- [ ] [Guild settings](#guild-settings)
- [ ] [Premium tier](#premium-tier)
- [ ] [Reaction roles](#reaction-roles)
- [ ] [Guild warnings](#guild-warnings)
- [ ] [Contest](#contest)
- [User profile](#user-profile)
- [ ] [Account balances](#account-balances)
- [ ] [User warnings](#user-warnings)
- [ ] [Reminders](#reminders)

<br>

## TODO:
- Figure out how to authenticate moderators of guilds (maybe OAuth or querying the bot process via RPC or something idk)

<br><br>

## Guild
### Guild Settings
```
GET /guild/:guildId/settings
```
Returns the entire settings object for a guild

```
PUT /guild/:guildId/settings
```
Overwrites the entire settings object for a guild

<br><br>

## User profile
### Account balances
```
GET /user/:userId/balances
```
Returns a user's balances from all guilds

```
GET /user/:userId/balance/:guildId
```
Returns a user's balance from a specific guild
Loading