pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import type Discord from "discord.js"; |
| 2 | import { Collection, MongoClient } from "mongodb"; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 3 | import config from "../config/main.json" assert { type: "json" }; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 4 | |
| 5 | const mongoClient = new MongoClient(config.mongoUrl); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 6 | await mongoClient.connect(); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 7 | const database = mongoClient.db("Nucleus"); |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 8 | |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 9 | export class Guilds { |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 10 | guilds: Collection<GuildConfig>; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 11 | defaultData: GuildConfig | null; |
| 12 | |
| 13 | constructor() { |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 14 | this.guilds = database.collection<GuildConfig>("guilds"); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 15 | this.defaultData = null; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 16 | } |
| 17 | |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 18 | async setup(): Promise<Guilds> { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 19 | this.defaultData = (await import("../config/default.json", { assert: { type: "json" } })) |
| 20 | .default as unknown as GuildConfig; |
| 21 | return this; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 22 | } |
| 23 | |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 24 | async read(guild: string): Promise<GuildConfig> { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 25 | const entry = await this.guilds.findOne({ id: guild }); |
PineaFan | df4996f | 2023-01-01 14:20:06 +0000 | [diff] [blame] | 26 | return Object.assign({}, this.defaultData, entry); |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 27 | } |
| 28 | |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 29 | async write(guild: string, set: object | null, unset: string[] | string = []) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 30 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 31 | const uo: Record<string, any> = {}; |
| 32 | if (!Array.isArray(unset)) unset = [unset]; |
| 33 | for (const key of unset) { |
pineafan | 0bc0416 | 2022-07-25 17:22:26 +0100 | [diff] [blame] | 34 | uo[key] = null; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 35 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 36 | const out = { $set: {}, $unset: {} }; |
| 37 | if (set) out.$set = set; |
| 38 | if (unset.length) out.$unset = uo; |
pineafan | 0bc0416 | 2022-07-25 17:22:26 +0100 | [diff] [blame] | 39 | await this.guilds.updateOne({ id: guild }, out, { upsert: true }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 40 | } |
| 41 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 42 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 43 | async append(guild: string, key: string, value: any) { |
| 44 | if (Array.isArray(value)) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 45 | await this.guilds.updateOne( |
| 46 | { id: guild }, |
| 47 | { |
| 48 | $addToSet: { [key]: { $each: value } } |
| 49 | }, |
| 50 | { upsert: true } |
| 51 | ); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 52 | } else { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 53 | await this.guilds.updateOne( |
| 54 | { id: guild }, |
| 55 | { |
| 56 | $addToSet: { [key]: value } |
| 57 | }, |
| 58 | { upsert: true } |
| 59 | ); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 63 | async remove( |
| 64 | guild: string, |
| 65 | key: string, |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 66 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 67 | value: any, |
| 68 | innerKey?: string | null |
| 69 | ) { |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 70 | if (innerKey) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 71 | await this.guilds.updateOne( |
| 72 | { id: guild }, |
| 73 | { |
| 74 | $pull: { [key]: { [innerKey]: { $eq: value } } } |
| 75 | }, |
| 76 | { upsert: true } |
| 77 | ); |
pineafan | 0bc0416 | 2022-07-25 17:22:26 +0100 | [diff] [blame] | 78 | } else if (Array.isArray(value)) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 79 | await this.guilds.updateOne( |
| 80 | { id: guild }, |
| 81 | { |
| 82 | $pullAll: { [key]: value } |
| 83 | }, |
| 84 | { upsert: true } |
| 85 | ); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 86 | } else { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 87 | await this.guilds.updateOne( |
| 88 | { id: guild }, |
| 89 | { |
| 90 | $pullAll: { [key]: [value] } |
| 91 | }, |
| 92 | { upsert: true } |
| 93 | ); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 94 | } |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 95 | } |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 96 | |
| 97 | async delete(guild: string) { |
| 98 | await this.guilds.deleteOne({ id: guild }); |
| 99 | } |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 100 | } |
| 101 | |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 102 | export class History { |
| 103 | histories: Collection<HistorySchema>; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 104 | |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 105 | constructor() { |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 106 | this.histories = database.collection<HistorySchema>("history"); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 109 | async create( |
| 110 | type: string, |
| 111 | guild: string, |
| 112 | user: Discord.User, |
| 113 | moderator: Discord.User | null, |
| 114 | reason: string | null, |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 115 | before?: string | null, |
| 116 | after?: string | null, |
| 117 | amount?: string | null |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 118 | ) { |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 119 | await this.histories.insertOne({ |
| 120 | type: type, |
| 121 | guild: guild, |
| 122 | user: user.id, |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 123 | moderator: moderator ? moderator.id : null, |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 124 | reason: reason, |
| 125 | occurredAt: new Date(), |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 126 | before: before ?? null, |
| 127 | after: after ?? null, |
| 128 | amount: amount ?? null |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 129 | }); |
| 130 | } |
| 131 | |
| 132 | async read(guild: string, user: string, year: number) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 133 | const entry = (await this.histories |
| 134 | .find({ |
| 135 | guild: guild, |
| 136 | user: user, |
| 137 | occurredAt: { |
| 138 | $gte: new Date(year - 1, 11, 31, 23, 59, 59), |
| 139 | $lt: new Date(year + 1, 0, 1, 0, 0, 0) |
| 140 | } |
| 141 | }) |
| 142 | .toArray()) as HistorySchema[]; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 143 | return entry; |
| 144 | } |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 145 | |
| 146 | async delete(guild: string) { |
| 147 | await this.histories.deleteMany({ guild: guild }); |
| 148 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 149 | } |
| 150 | |
TheCodedProf | b5e9d55 | 2023-01-29 15:43:26 -0500 | [diff] [blame] | 151 | interface ScanCacheSchema { |
| 152 | addedAt: Date; |
| 153 | hash: string; |
| 154 | data: boolean; |
| 155 | tags: string[]; |
| 156 | } |
| 157 | |
| 158 | export class ScanCache { |
| 159 | scanCache: Collection<ScanCacheSchema>; |
| 160 | |
| 161 | constructor() { |
| 162 | this.scanCache = database.collection<ScanCacheSchema>("scanCache"); |
| 163 | } |
| 164 | |
| 165 | async read(hash: string) { |
| 166 | return await this.scanCache.findOne({ hash: hash }); |
| 167 | } |
| 168 | |
| 169 | async write(hash: string, data: boolean, tags?: string[]) { |
| 170 | await this.scanCache.insertOne({ hash: hash, data: data, tags: tags ?? [], addedAt: new Date() }); // TODO: cleanup function maybe |
| 171 | } |
| 172 | |
| 173 | async cleanup() { |
| 174 | await this.scanCache.deleteMany({ addedAt: { $lt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 31)) }, hash: { $not$text: "http"} }); |
| 175 | } |
| 176 | } |
| 177 | |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 178 | export class PerformanceTest { |
| 179 | performanceData: Collection<PerformanceDataSchema>; |
| 180 | |
| 181 | constructor() { |
| 182 | this.performanceData = database.collection<PerformanceDataSchema>("performance"); |
| 183 | } |
| 184 | |
| 185 | async record(data: PerformanceDataSchema) { |
| 186 | data.timestamp = new Date(); |
| 187 | await this.performanceData.insertOne(data); |
| 188 | } |
| 189 | async read() { |
| 190 | return await this.performanceData.find({}).toArray(); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | export interface PerformanceDataSchema { |
| 195 | timestamp?: Date; |
| 196 | discord: number; |
| 197 | databaseRead: number; |
| 198 | resources: { |
| 199 | cpu: number; |
| 200 | memory: number; |
| 201 | temperature: number; |
| 202 | } |
| 203 | } |
| 204 | |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 205 | export class ModNotes { |
| 206 | modNotes: Collection<ModNoteSchema>; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 207 | |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 208 | constructor() { |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 209 | this.modNotes = database.collection<ModNoteSchema>("modNotes"); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | async create(guild: string, user: string, note: string | null) { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 213 | await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { note: note } }, { upsert: true }); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | async read(guild: string, user: string) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 217 | const entry = await this.modNotes.findOne({ guild: guild, user: user }); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 218 | return entry?.note ?? null; |
| 219 | } |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame] | 220 | |
| 221 | async delete(guild: string) { |
| 222 | await this.modNotes.deleteMany({ guild: guild }); |
| 223 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 224 | } |
| 225 | |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 226 | export class Premium { |
| 227 | premium: Collection<PremiumSchema>; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 228 | |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 229 | constructor() { |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 230 | this.premium = database.collection<PremiumSchema>("premium"); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 231 | } |
| 232 | |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 233 | async hasPremium(guild: string) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 234 | const entry = await this.premium.findOne({ |
| 235 | appliesTo: { $in: [guild] } |
| 236 | }); |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame] | 237 | if (!entry) return false; |
| 238 | return entry.expires.valueOf() > Date.now(); |
| 239 | } |
| 240 | |
| 241 | async fetchTotal(user: string): Promise<number> { |
| 242 | const entry = await this.premium.findOne({ user: user }); |
| 243 | if (!entry) return 0; |
| 244 | return entry.appliesTo.length; |
| 245 | } |
| 246 | |
TheCodedProf | fc420b7 | 2023-01-24 17:14:38 -0500 | [diff] [blame] | 247 | addPremium(user: string, guild: string) { |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame] | 248 | return this.premium.updateOne({ user: user }, { $addToSet: { appliesTo: guild } }, { upsert: true }); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 249 | } |
TheCodedProf | fc420b7 | 2023-01-24 17:14:38 -0500 | [diff] [blame] | 250 | |
| 251 | removePremium(user: string, guild: string) { |
| 252 | return this.premium.updateOne({ user: user }, { $pull: { appliesTo: guild } }); |
| 253 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 254 | } |
| 255 | |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 256 | export interface GuildConfig { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 257 | id: string; |
| 258 | version: number; |
PineaFan | 100df68 | 2023-01-02 13:26:08 +0000 | [diff] [blame] | 259 | singleEventNotifications: Record<string, boolean>; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 260 | filters: { |
| 261 | images: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 262 | NSFW: boolean; |
| 263 | size: boolean; |
| 264 | }; |
| 265 | malware: boolean; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 266 | wordFilter: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 267 | enabled: boolean; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 268 | words: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 269 | strict: string[]; |
| 270 | loose: string[]; |
| 271 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 272 | allowed: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 273 | users: string[]; |
| 274 | roles: string[]; |
| 275 | channels: string[]; |
| 276 | }; |
| 277 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 278 | invite: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 279 | enabled: boolean; |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 280 | allowed: { |
| 281 | channels: string[]; |
| 282 | roles: string[]; |
| 283 | users: string[]; |
| 284 | }; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 285 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 286 | pings: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 287 | mass: number; |
| 288 | everyone: boolean; |
| 289 | roles: boolean; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 290 | allowed: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 291 | roles: string[]; |
| 292 | rolesToMention: string[]; |
| 293 | users: string[]; |
| 294 | channels: string[]; |
| 295 | }; |
| 296 | }; |
| 297 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 298 | welcome: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 299 | enabled: boolean; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 300 | role: string | null; |
| 301 | ping: string | null; |
| 302 | channel: string | null; |
| 303 | message: string | null; |
| 304 | }; |
| 305 | stats: Record<string, { name: string; enabled: boolean }>; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 306 | logging: { |
| 307 | logs: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 308 | enabled: boolean; |
| 309 | channel: string | null; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 310 | toLog: string; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 311 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 312 | staff: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 313 | channel: string | null; |
| 314 | }; |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 315 | attachments: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 316 | channel: string | null; |
| 317 | saved: Record<string, string>; |
| 318 | }; |
| 319 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 320 | verify: { |
PineaFan | df4996f | 2023-01-01 14:20:06 +0000 | [diff] [blame] | 321 | enabled: boolean; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 322 | role: string | null; |
| 323 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 324 | tickets: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 325 | enabled: boolean; |
| 326 | category: string | null; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 327 | types: string; |
| 328 | customTypes: string[] | null; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 329 | useCustom: boolean; |
| 330 | supportRole: string | null; |
| 331 | maxTickets: number; |
| 332 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 333 | moderation: { |
| 334 | mute: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 335 | timeout: boolean; |
| 336 | role: string | null; |
| 337 | text: string | null; |
| 338 | link: string | null; |
| 339 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 340 | kick: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 341 | text: string | null; |
| 342 | link: string | null; |
| 343 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 344 | ban: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 345 | text: string | null; |
| 346 | link: string | null; |
| 347 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 348 | softban: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 349 | text: string | null; |
| 350 | link: string | null; |
| 351 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 352 | warn: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 353 | text: string | null; |
| 354 | link: string | null; |
| 355 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 356 | role: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 357 | role: string | null; |
TheCodedProf | d9636e8 | 2023-01-17 22:13:06 -0500 | [diff] [blame] | 358 | text: null; |
| 359 | link: null; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 360 | }; |
PineaFan | e6ba788 | 2023-01-18 20:41:16 +0000 | [diff] [blame] | 361 | nick: { |
| 362 | text: string | null; |
| 363 | link: string | null; |
| 364 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 365 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 366 | tracks: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 367 | name: string; |
| 368 | retainPrevious: boolean; |
| 369 | nullable: boolean; |
| 370 | track: string[]; |
| 371 | manageableBy: string[]; |
| 372 | }[]; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 373 | roleMenu: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 374 | enabled: boolean; |
| 375 | allowWebUI: boolean; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 376 | options: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 377 | name: string; |
| 378 | description: string; |
| 379 | min: number; |
| 380 | max: number; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 381 | options: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 382 | name: string; |
| 383 | description: string | null; |
| 384 | role: string; |
| 385 | }[]; |
| 386 | }[]; |
| 387 | }; |
| 388 | tags: Record<string, string>; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 389 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 390 | |
| 391 | export interface HistorySchema { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 392 | type: string; |
| 393 | guild: string; |
| 394 | user: string; |
| 395 | moderator: string | null; |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 396 | reason: string | null; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 397 | occurredAt: Date; |
| 398 | before: string | null; |
| 399 | after: string | null; |
| 400 | amount: string | null; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | export interface ModNoteSchema { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 404 | guild: string; |
| 405 | user: string; |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 406 | note: string | null; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 407 | } |
| 408 | |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 409 | export interface PremiumSchema { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 410 | user: string; |
| 411 | level: number; |
| 412 | expires: Date; |
| 413 | appliesTo: string[]; |
| 414 | } |