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