I'm just a little daft for this one.
This commit is contained in:
+2
-17
@@ -1,7 +1,7 @@
|
||||
import sqlite3 from 'sqlite3';
|
||||
import { open, Database as SqliteDatabase } from 'sqlite';
|
||||
import { serializeMessage, wait } from '../utils';
|
||||
import { GuildSettings, LoggedMessage, TicketMessage, TicketPhrase, Note, Ban, GuildArraySetting, GithubUserMapping, KnowledgebaseItem, PrivateHelpTicket } from '../types';
|
||||
import { GuildSettings, LoggedMessage, TicketMessage, TicketPhrase, Note, Ban, GuildArraySetting, GithubUserMapping, KnowledgebaseItem, PrivateHelpTicket, GuildSetting } from '../types';
|
||||
import { Message } from '../events';
|
||||
|
||||
const DB_SCHEMA = `
|
||||
@@ -114,21 +114,6 @@ export const enum PrivateHelpTicketStatus {
|
||||
CLOSED = 1
|
||||
}
|
||||
|
||||
type GuildSettingKey =
|
||||
| 'general_chat_id'
|
||||
| 'tickets_channel_id'
|
||||
| 'event_logs_channel_id'
|
||||
| 'discord_logs_channel_id'
|
||||
| 'audit_logs_channel_id'
|
||||
| 'voice_logs_channel_id'
|
||||
| 'new_member_channel_id'
|
||||
| 'moderator_channel_id'
|
||||
| 'admin_role_id'
|
||||
| 'private_help_role_id'
|
||||
| 'devwatch_role_id'
|
||||
| 'github_release_channel'
|
||||
| 'private_help_channel_id';
|
||||
|
||||
export class Database {
|
||||
private static db: SqliteDatabase;
|
||||
|
||||
@@ -199,7 +184,7 @@ export class Database {
|
||||
await Database.db.run('INSERT INTO settings(guild_id) VALUES (?)', guildId);
|
||||
}
|
||||
|
||||
static async updateGuildSettings(guildId: string, key: GuildSettingKey, value: string) {
|
||||
static async updateGuildSettings(guildId: string, key: GuildSetting, value: string) {
|
||||
await Database.db.run(`UPDATE settings SET ${key} = ? WHERE guild_id = ?`, value, guildId);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+80
-79
@@ -1,79 +1,80 @@
|
||||
export type LoggedMessage = {
|
||||
id: string
|
||||
author_id: string
|
||||
author_name: string
|
||||
channel_id: string
|
||||
attachments: string
|
||||
stickers: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export type GuildSettings = {
|
||||
guild_id: string
|
||||
general_chat_id?: string
|
||||
new_member_channel_id?: string
|
||||
tickets_channel_id?: string
|
||||
event_logs_channel_id?: string
|
||||
discord_logs_channel_id?: string
|
||||
audit_logs_channel_id?: string
|
||||
voice_logs_channel_id?: string
|
||||
admin_role_id?: string
|
||||
private_help_role_id?: string
|
||||
devwatch_role_id?: string
|
||||
staff_categories?: string
|
||||
safe_channels?: string
|
||||
link_skip_channels?: string
|
||||
github_release_channel?: string
|
||||
moderator_channel_id?: string
|
||||
private_help_channel_id?: string
|
||||
}
|
||||
|
||||
export type GuildArraySetting = 'staff_categories' | 'safe_channels' | 'link_skip_channels';
|
||||
|
||||
export type TicketMessage = {
|
||||
id: number
|
||||
message_id: string
|
||||
}
|
||||
|
||||
export type TicketPhrase = {
|
||||
id: number
|
||||
user_id: string
|
||||
phrase: string
|
||||
}
|
||||
|
||||
export type Note = {
|
||||
id: number
|
||||
user_id: string
|
||||
reason: string
|
||||
mod_id: string
|
||||
timestamp: string
|
||||
}
|
||||
|
||||
export type Ban = {
|
||||
id: number
|
||||
user_id: string
|
||||
expires: 0 | 1
|
||||
expires_at: string
|
||||
full_ban: 0 | 1
|
||||
}
|
||||
|
||||
export type GithubUserMapping = {
|
||||
id: number
|
||||
discord_id: string
|
||||
github_username: string
|
||||
}
|
||||
|
||||
export type KnowledgebaseItem = {
|
||||
id: number
|
||||
guild_id: string
|
||||
name: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export type PrivateHelpTicket = {
|
||||
id: number
|
||||
user_id: string
|
||||
thread_id: string
|
||||
status: PrivateHelpTicketStatus
|
||||
timestamp: string
|
||||
}
|
||||
export type LoggedMessage = {
|
||||
id: string
|
||||
author_id: string
|
||||
author_name: string
|
||||
channel_id: string
|
||||
attachments: string
|
||||
stickers: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export type GuildSettings = {
|
||||
guild_id: string
|
||||
general_chat_id?: string
|
||||
new_member_channel_id?: string
|
||||
tickets_channel_id?: string
|
||||
event_logs_channel_id?: string
|
||||
discord_logs_channel_id?: string
|
||||
audit_logs_channel_id?: string
|
||||
voice_logs_channel_id?: string
|
||||
admin_role_id?: string
|
||||
private_help_role_id?: string
|
||||
devwatch_role_id?: string
|
||||
staff_categories?: string
|
||||
safe_channels?: string
|
||||
link_skip_channels?: string
|
||||
github_release_channel?: string
|
||||
moderator_channel_id?: string
|
||||
private_help_channel_id?: string
|
||||
}
|
||||
|
||||
type GuildSetting = Exclude<keyof GuildSettings, 'guild_id'>
|
||||
export type GuildArraySetting = 'staff_categories' | 'safe_channels' | 'link_skip_channels';
|
||||
|
||||
export type TicketMessage = {
|
||||
id: number
|
||||
message_id: string
|
||||
}
|
||||
|
||||
export type TicketPhrase = {
|
||||
id: number
|
||||
user_id: string
|
||||
phrase: string
|
||||
}
|
||||
|
||||
export type Note = {
|
||||
id: number
|
||||
user_id: string
|
||||
reason: string
|
||||
mod_id: string
|
||||
timestamp: string
|
||||
}
|
||||
|
||||
export type Ban = {
|
||||
id: number
|
||||
user_id: string
|
||||
expires: 0 | 1
|
||||
expires_at: string
|
||||
full_ban: 0 | 1
|
||||
}
|
||||
|
||||
export type GithubUserMapping = {
|
||||
id: number
|
||||
discord_id: string
|
||||
github_username: string
|
||||
}
|
||||
|
||||
export type KnowledgebaseItem = {
|
||||
id: number
|
||||
guild_id: string
|
||||
name: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export type PrivateHelpTicket = {
|
||||
id: number
|
||||
user_id: string
|
||||
thread_id: string
|
||||
status: PrivateHelpTicketStatus
|
||||
timestamp: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user