logchannel command

This commit is contained in:
Lukas | AstroGD 2022-11-24 12:12:50 +01:00
parent d8365128fc
commit 082bfe6097
Signed by: AstroGD
GPG Key ID: 82A5E6C236C535AA
8 changed files with 38 additions and 17 deletions

View File

@ -5,16 +5,16 @@ services:
build: ./ build: ./
depends_on: depends_on:
- database - database
restart: always restart: unless-stopped
environment: environment:
- TOKEN=$TOKEN - TOKEN=$TOKEN
- DB_HOST=database:5432 - DB_HOST=database
- DB_USERNAME=$DB_USERNAME - DB_USERNAME=$DB_USERNAME
- DB_PASSWORD=$DB_PASSWORD - DB_PASSWORD=$DB_PASSWORD
- DB_DATABASE=$DB_DATABASE - DB_DATABASE=$DB_DATABASE
database: database:
image: postgres:latest image: postgres:latest
restart: always restart: unless-stopped
ports: ports:
- 5432:5432 - 5432:5432
environment: environment:

View File

@ -4,10 +4,13 @@ import swapConsole from "./src/tools/consoleSwapper";
config(); config();
swapConsole(); swapConsole();
import "./src/client"; import "./src/client/init";
import "./src/commands";
import client from "./src/client";
function shutdown() { function shutdown() {
console.log("Shutdown request received"); console.log("Shutdown request received");
if (client) client.destroy();
process.exit(); process.exit();
} }

16
package-lock.json generated
View File

@ -18,6 +18,7 @@
"devDependencies": { "devDependencies": {
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^9.0.13",
"@types/node": "^18.11.9", "@types/node": "^18.11.9",
"rimraf": "^3.0.2",
"shx": "^0.3.4", "shx": "^0.3.4",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.9.3" "typescript": "^4.9.3"
@ -1029,6 +1030,21 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/safe-buffer": { "node_modules/safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",

View File

@ -27,6 +27,7 @@
"devDependencies": { "devDependencies": {
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^9.0.13",
"@types/node": "^18.11.9", "@types/node": "^18.11.9",
"rimraf": "^3.0.2",
"shx": "^0.3.4", "shx": "^0.3.4",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.9.3" "typescript": "^4.9.3"

View File

@ -6,15 +6,4 @@ const client = new Client({
] ]
}); });
const token = process.env["TOKEN"]; export default client;
if (!token) throw new ReferenceError("TOKEN environment variable is missing");
client.login(token);
client.on("ready", () => {
console.log(`Connected to Discord API. Bot account is ${client.user?.tag} (${client.user?.id})`);
});
export default client;
import "../commands";

10
src/client/init.ts Normal file
View File

@ -0,0 +1,10 @@
import client from "./index";
const token = process.env["TOKEN"];
if (!token) throw new ReferenceError("TOKEN environment variable is missing");
client.login(token);
client.on("ready", () => {
console.log(`Connected to Discord API. Bot account is ${client.user?.tag} (${client.user?.id})`);
});

View File

@ -28,4 +28,6 @@ const dataSource = new DataSource({
migrationsTransactionMode: "each" migrationsTransactionMode: "each"
}); });
dataSource.initialize();
export default dataSource; export default dataSource;

View File

@ -15,7 +15,7 @@
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */ // "jsx": "preserve", /* Specify what JSX code is generated. */
"experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */