Skip to content

Commit

Permalink
feat: Improve development mode (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoufuyuki authored Aug 16, 2020
1 parent cb66729 commit b0d4f6c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
},
"password": ""
},
"myriad": ""
"myriad": "",
"debug": false
}
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ services:
build:
context: ./
dockerfile: Dockerfile
env_file:
- .env
network_mode: host
restart: unless-stopped
version: "2.4"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "eslint --ignore-path .gitignore \"**/*.+(ts|js)\"",
"lint:fix": "eslint --ignore-path .gitignore \"**/*.+(ts|js)\" --fix",
"start": "node dist",
"start:dev": "ts-node ./src",
"start:dev": "ts-node ./src dev",
"test": "yarn lint && yarn build"
},
"repository": "https://github.com/youKnowOwO/yumeko-ts.git",
Expand Down
12 changes: 12 additions & 0 deletions src/events/Debug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type YumekoClient from "../classes/Client";
import { Event } from "../interfaces";

export default class DebugEvent implements Event {
public readonly listener = "debug";
public constructor(public readonly client: YumekoClient) {}
public exec(msg: string): void {
if (this.client.config.debug) {
this.client.log.info(msg);
}
}
}
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import YumekoClient from "./classes/Client";
import "./util/EnvLoader";

if (process.argv[2] === "dev") {
require("./util/EnvLoader");
require("../config.json").debug = true;
}
const client = new YumekoClient();

client.login(process.env.TOKEN);

0 comments on commit b0d4f6c

Please sign in to comment.