forked from PluralFlux/PluralFlux
Compare commits
17 Commits
webhook-re
...
add-system
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee4dca2ae3 | ||
|
|
ff4dba3dfd | ||
|
|
96c2abc06a | ||
| b602e654ec | |||
| 732ad36bba | |||
| 8446559bfb | |||
| 14ef1581c1 | |||
| 10eab6de74 | |||
| d8682c2a1b | |||
| 20e8564c15 | |||
| 78cda7d3c4 | |||
| 21587dcb7a | |||
| aeb7d88ee9 | |||
| 8fe53563d0 | |||
| d14e89e8b2 | |||
| 39a7115803 | |||
|
|
72b70f5175 |
@@ -8,7 +8,7 @@ on:
|
|||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
|
|||||||
47
database/entity/System.ts
Normal file
47
database/entity/System.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Unique} from "typeorm"
|
||||||
|
|
||||||
|
@Entity({name: "System", synchronize: true})
|
||||||
|
@Unique("UQ_System_userid", ['userid'])
|
||||||
|
@Unique("UQ_System_shortid", ['shortid'])
|
||||||
|
export class System {
|
||||||
|
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
shortid: string
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
userid: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
length: 100,
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
name: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "varchar",
|
||||||
|
nullable: true,
|
||||||
|
length: 100
|
||||||
|
})
|
||||||
|
fronter: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
grouptag: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
autoproxy: string
|
||||||
|
|
||||||
|
@CreateDateColumn({ type: 'timestamptz' })
|
||||||
|
createdAt: Date
|
||||||
|
|
||||||
|
@UpdateDateColumn({ type: 'timestamptz' })
|
||||||
|
updatedAt: Date
|
||||||
|
}
|
||||||
14
database/migrations/1773670748825-update.ts
Normal file
14
database/migrations/1773670748825-update.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class Update1773670748825 implements MigrationInterface {
|
||||||
|
name = 'Update1773670748825'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`CREATE TABLE "System" ("id" SERIAL NOT NULL, "shortid" character varying, "userid" character varying NOT NULL, "name" character varying(100), "fronter" character varying(100), "grouptag" character varying, "autoproxy" character varying, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "UQ_System_shortid" UNIQUE ("shortid"), CONSTRAINT "UQ_System_userid" UNIQUE ("userid"), CONSTRAINT "PK_b8e3f6855de5a4758fcb59e5567" PRIMARY KEY ("id"))`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DROP TABLE "System"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
13
database/migrations/1773749921832-update.ts
Normal file
13
database/migrations/1773749921832-update.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class Update1773749921832 implements MigrationInterface {
|
||||||
|
name = 'Update1773749921832'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`INSERT INTO "System" ("userid") SELECT DISTINCT "userid" FROM "Member";`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DELETE from "System" USING "Member" WHERE "System".userid = "Member".userid;`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,6 @@ const { AppDataSource } = require("../database/data-source");
|
|||||||
env.config();
|
env.config();
|
||||||
|
|
||||||
const token = process.env.FLUXER_BOT_TOKEN;
|
const token = process.env.FLUXER_BOT_TOKEN;
|
||||||
const debug = process.env.debug;
|
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
console.error("Missing FLUXER_BOT_TOKEN environment variable.");
|
console.error("Missing FLUXER_BOT_TOKEN environment variable.");
|
||||||
@@ -64,15 +63,12 @@ module.exports.handleMessageCreate = async function(message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(error) {
|
catch(error) {
|
||||||
if(debug){console.error("An error occurred at unix timestamp " + Date.now() + "while processing the command: " + message + " with error:" + error);}
|
console.error(error);
|
||||||
else{console.error(error);}
|
|
||||||
process.exit(2); //need this for now just to make sure the bot continues to restart on errors, since it would seem that fluxer.js doesn't define custom error types. TODO: map out some exit codes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.on(Events.Ready, () => {
|
client.on(Events.Ready, () => {
|
||||||
console.log(`Logged in as ${client.user?.username}`);
|
console.log(`Logged in as ${client.user?.username}`);
|
||||||
if(debug){console.log(Date.now() + `: Currently running in debug mode!`)}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let guildCount = 0;
|
let guildCount = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user