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