mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Counters v0.9
Includes automod trigger/action. No user-facing commands yet.
This commit is contained in:
parent
ec37cf27a2
commit
c3407e2d5d
29 changed files with 1387 additions and 3 deletions
25
backend/src/data/entities/Counter.ts
Normal file
25
backend/src/data/entities/Counter.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("counters")
|
||||
export class Counter {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
guild_id: string;
|
||||
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@Column()
|
||||
per_channel: boolean;
|
||||
|
||||
@Column()
|
||||
per_user: boolean;
|
||||
|
||||
@Column()
|
||||
last_decay_at: string;
|
||||
|
||||
@Column({ type: "datetime", nullable: true })
|
||||
delete_at: string | null;
|
||||
}
|
23
backend/src/data/entities/CounterTrigger.ts
Normal file
23
backend/src/data/entities/CounterTrigger.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
export const TRIGGER_COMPARISON_OPS = ["=", "!=", ">", "<", ">=", "<="] as const;
|
||||
|
||||
export type TriggerComparisonOp = typeof TRIGGER_COMPARISON_OPS[number];
|
||||
|
||||
@Entity("counter_triggers")
|
||||
export class CounterTrigger {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
counter_id: number;
|
||||
|
||||
@Column({ type: "varchar" })
|
||||
comparison_op: TriggerComparisonOp;
|
||||
|
||||
@Column()
|
||||
comparison_value: number;
|
||||
|
||||
@Column({ type: "datetime", nullable: true })
|
||||
delete_at: string | null;
|
||||
}
|
17
backend/src/data/entities/CounterTriggerState.ts
Normal file
17
backend/src/data/entities/CounterTriggerState.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("counter_trigger_states")
|
||||
export class CounterTriggerState {
|
||||
@Column()
|
||||
@PrimaryColumn()
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
trigger_id: number;
|
||||
|
||||
@Column({ type: "bigint" })
|
||||
channel_id: string;
|
||||
|
||||
@Column({ type: "bigint" })
|
||||
user_id: string;
|
||||
}
|
20
backend/src/data/entities/CounterValue.ts
Normal file
20
backend/src/data/entities/CounterValue.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity("counter_values")
|
||||
export class CounterValue {
|
||||
@Column()
|
||||
@PrimaryColumn()
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
counter_id: number;
|
||||
|
||||
@Column({ type: "bigint" })
|
||||
channel_id: string;
|
||||
|
||||
@Column({ type: "bigint" })
|
||||
user_id: string;
|
||||
|
||||
@Column()
|
||||
value: number;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue