jillo-bot/src/lib/db.ts

89 lines
1.7 KiB
TypeScript
Raw Normal View History

import knex from 'knex';
2023-11-11 01:54:11 +01:00
import * as log from './log';
export const db = knex({
client: 'sqlite3',
connection: {
filename: './jillo.sqlite'
},
2023-11-11 01:54:11 +01:00
useNullAsDefault: true,
log: {
warn: log.warn,
error: log.error,
deprecate: log.warn,
debug: log.info
}
});
export interface ScheduledSubscription {
name: string;
next: number;
}
export interface Subscription {
key: string,
channel: string,
guild?: string
}
2023-11-11 00:01:38 +01:00
export interface Counter {
id: number,
2023-11-11 00:01:38 +01:00
key: string,
emoji: string,
value: number,
channel: string,
guild: string,
message?: string,
2023-11-12 19:45:23 +01:00
allowlistConsumer: boolean,
2023-11-15 11:03:01 +01:00
allowlistProducer: boolean,
linkedItem?: number
2023-11-11 00:01:38 +01:00
}
2023-11-12 19:45:23 +01:00
export interface CounterUserLink {
id: number,
2023-11-12 19:45:23 +01:00
user: string,
producer: boolean
2023-11-13 16:10:33 +01:00
}
export interface CounterConfiguration {
id: number,
2023-11-13 16:10:33 +01:00
configName: string,
value: string
2023-11-15 01:40:57 +01:00
}
export interface CustomItem {
id: number,
guild: string,
name: string,
description?: string,
emoji: string,
type: 'plain' | 'weapon' | 'consumable',
// also damage for weapons; weapons are always unstackable (cus i said so)
maxStack: number,
behavior?: string,
untradable: boolean,
behaviorValue?: number
}
export interface ItemInventory {
user: string,
item: number,
quantity: number
2023-11-15 16:04:36 +01:00
}
export interface CraftingStationCooldown {
station: string,
user: string,
usedAt: number
2023-11-18 12:59:29 +01:00
}
export interface CustomCraftingRecipe {
id: number,
2023-11-18 13:24:56 +01:00
guild: string,
2023-11-18 12:59:29 +01:00
station: string
}
export interface CustomCraftingRecipeItem {
id: number,
item: number,
quantity: number,
type: 'input' | 'output' | 'requirement'
2023-11-19 21:28:31 +01:00
}
export interface Session {
id: string,
tokenType: string,
accessToken: string,
refreshToken: string,
expiresAt: number,
}