jillo-bot/src/lib/db.ts

43 lines
769 B
TypeScript

import knex from 'knex';
import * as log from './log';
export const db = knex({
client: 'sqlite3',
connection: {
filename: './jillo.sqlite'
},
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
}
export interface Counter {
key: string,
name: string,
emoji: string,
value: number,
channel: string,
guild: string,
message?: string,
messageTemplate?: string,
allowlistConsumer: boolean,
allowlistProducer: boolean
}
export interface CounterUserLink {
key: string,
user: string,
producer: boolean
}