File tree 15 files changed +4659
-34
lines changed
15 files changed +4659
-34
lines changed Original file line number Diff line number Diff line change 1
1
.vscode
2
- package-lock.json
3
- yarn.lock
4
2
.envrc
5
3
/lib
6
4
/tmp
Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ services:
8
8
9
9
bot :
10
10
build : .
11
- command : node ./lib/server.js
11
+ command : yarn dev
12
12
ports :
13
13
- " 3000:3000"
14
14
volumes :
15
- - ./lib :/app/lib
15
+ - ./src :/app/src
16
16
env_file : .env
17
17
environment :
18
18
MONGODB_URL : mongodb://mongo:27017/shipid
Original file line number Diff line number Diff line change @@ -10,11 +10,15 @@ services:
10
10
bot :
11
11
build : .
12
12
restart : unless-stopped
13
- command : yarn start
13
+ command : node .
14
14
env_file : .env
15
15
environment :
16
16
MONGODB_URL : mongodb://mongo:27017/shipid
17
- DEBUG : shipid
18
- VIRTUAL_HOST : shipid.holodata.org
19
- VIRTUAL_PORT : 3000
20
- LETSENCRYPT_HOST : shipid.holodata.org
17
+ NODE_ENV : production
18
+ networks :
19
+ - default
20
+ - webproxy
21
+
22
+ networks :
23
+ webproxy :
24
+ external : true
Original file line number Diff line number Diff line change 6
6
"scripts" : {
7
7
"build" : " tsc" ,
8
8
"clean" : " shx rm -rf lib" ,
9
- "dev" : " tsc -w" ,
9
+ "dev" : " run-p dev:*" ,
10
+ "dev:server" : " nodemon -w lib ./lib/server.js" ,
11
+ "dev:tsc" : " tsc -w" ,
12
+ "devcontainer" : " docker-compose -f docker-compose.development.yml up" ,
10
13
"prepare" : " husky install" ,
14
+ "start" : " node ./lib/server.js" ,
11
15
"test" : " jest"
12
16
},
13
- "main" : " lib/server.js" ,
17
+ "main" : " ./ lib/server.js" ,
14
18
"files" : [
15
19
" lib"
16
20
],
Original file line number Diff line number Diff line change 1
- import { PREFIX } from "../../../constants" ;
2
- import { findOrCreateGuild } from "../../../db" ;
3
1
import { HandlerOptions } from "../interfaces" ;
4
2
import { checkModPermission } from "../util" ;
3
+ import { PREFIX } from "/@/constants" ;
4
+ import { findOrCreateGuild } from "/@/db" ;
5
5
6
6
export const pair = {
7
7
// !sid pair <channelId> <role name>
Original file line number Diff line number Diff line change 1
- import { getUserByDiscordId } from "../../../db" ;
2
1
import { HandlerOptions } from "../interfaces" ;
3
2
import { applyRolesPhase } from "../phases/applyRolesPhase" ;
4
3
import { onboardingPhase } from "../phases/onboardingPhase" ;
5
4
import { verificationPhase } from "../phases/verificationPhase" ;
5
+ import { getUserByDiscordId } from "/@/db" ;
6
6
7
7
export const verify = {
8
8
// !sid verify
Original file line number Diff line number Diff line change 1
1
import Discord from "discord.js" ;
2
- import { HB_MONGO_URI } from "../../constants" ;
3
- import { log } from "../../util" ;
4
- import { Honeybee } from "../honeybee" ;
5
2
import { commands } from "./commands" ;
3
+ import { HB_MONGO_URI } from "/@/constants" ;
4
+ import { Honeybee } from "/@/modules/honeybee" ;
5
+ import { log } from "/@/util" ;
6
6
7
7
export function createBot ( { prefix } : { prefix : string } ) {
8
8
const hb = new Honeybee ( HB_MONGO_URI ) ;
@@ -17,7 +17,7 @@ export function createBot({ prefix }: { prefix: string }) {
17
17
const args = payload ;
18
18
19
19
if ( ! commandName ) return ;
20
- console . log ( `command: ${ commandName } ` , payload ) ;
20
+ log ( `command: ${ commandName } ` , payload ) ;
21
21
22
22
const command = commands . find (
23
23
( command ) => command . command === commandName
Original file line number Diff line number Diff line change 1
1
import Discord from "discord.js" ;
2
- import { Honeybee } from ".. /honeybee" ;
2
+ import { Honeybee } from "/@/modules /honeybee" ;
3
3
4
4
export interface HandlerOptions {
5
5
message : Discord . Message ;
Original file line number Diff line number Diff line change 1
- import jwt from "jsonwebtoken" ;
2
- import { HOST , JWT_SECRET } from "../../../constants" ;
3
- import { JwtToken } from "../../../auth" ;
4
1
import { Message } from "discord.js" ;
2
+ import jwt from "jsonwebtoken" ;
3
+ import { JwtToken } from "/@/auth" ;
4
+ import { HOST , JWT_SECRET } from "/@/constants" ;
5
+ import { log } from "/@/util" ;
5
6
6
7
export function onboardingPhase ( message : Message ) {
7
- console . log ( "onboardingPhase" ) ;
8
+ log ( "onboardingPhase" ) ;
8
9
const payload : JwtToken = {
9
10
discordId : message . author . id ,
10
11
iat : Date . now ( ) ,
Original file line number Diff line number Diff line change 1
- import { getRoleMapsForGuild } from "../../../db" ;
2
1
import { Message } from "discord.js" ;
3
- import { User } from "../../../models/user" ;
4
- import { Honeybee } from "../../honeybee" ;
5
2
import { RoleChangeset } from "../interfaces" ;
3
+ import { getRoleMapsForGuild } from "/@/db" ;
4
+ import { User } from "/@/models/user" ;
5
+ import { Honeybee } from "/@/modules/honeybee" ;
6
6
7
7
export async function verificationPhase (
8
8
message : Message ,
Original file line number Diff line number Diff line change 1
- import { getModelForClass , ReturnModelType } from "@typegoose/typegoose" ;
2
- import { BeAnObject } from "@typegoose/typegoose/lib/types" ;
1
+ import { getModelForClass } from "@typegoose/typegoose" ;
3
2
import mongoose from "mongoose" ;
4
3
import { Chat } from "./chat" ;
5
4
Original file line number Diff line number Diff line change 1
1
import { Request , Response , Router } from "express" ;
2
2
import { Auth , google , youtube_v3 } from "googleapis" ;
3
3
import jwt from "jsonwebtoken" ;
4
- import { JWT_SECRET } from "../../constants " ;
5
- import { JwtToken } from "../../auth " ;
6
- import UserModel from "../.. /models/user" ;
4
+ import { JwtToken } from "/@/auth " ;
5
+ import { JWT_SECRET } from "/@/constants " ;
6
+ import UserModel from "/@ /models/user" ;
7
7
8
8
export function createYouTubeHandler ( {
9
9
clientId,
Original file line number Diff line number Diff line change 6
6
GOOGLE_CLIENT_ID ,
7
7
GOOGLE_CLIENT_SECRET ,
8
8
HOST ,
9
+ isDev ,
9
10
MONGODB_URL ,
10
11
PORT ,
11
12
PREFIX ,
@@ -33,6 +34,6 @@ app.use(youtubeHandler);
33
34
const server = http . createServer ( app ) ;
34
35
35
36
server . listen ( PORT , ( ) => {
36
- console . log ( "http://localhost:" + PORT ) ;
37
+ console . log ( `Listening ${ PREFIX } at ${ HOST } ( ${ isDev ? "dev" : "prod" } )` ) ;
37
38
bot . login ( DISCORD_TOKEN ) ;
38
39
} ) ;
Original file line number Diff line number Diff line change 46
46
47
47
/* Module Resolution Options */
48
48
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
49
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
50
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
49
+ "baseUrl" : " ./" /* Base directory to resolve non-absolute module names. */ ,
50
+ "paths" : {
51
+ "/@/*" : [" ./src/*" ]
52
+ } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ ,
51
53
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
52
54
// "typeRoots": [], /* List of folders to include type definitions from. */
53
55
// "types": [], /* Type declaration files to be included in compilation. */
You can’t perform that action at this time.
0 commit comments