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