blob: 432a9f82cf210ea20466d0652afaebb871a0cac9 [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001import { MongoClient } from "mongodb";
pineafan4edb7762022-06-26 19:21:04 +01002
pineafan63fc5e22022-08-04 22:04:10 +01003const mongoClient = new MongoClient("mongodb://127.0.0.1:27017/local");
4await mongoClient.connect();
pineafan4edb7762022-06-26 19:21:04 +01005const database = mongoClient.db("Nucleus");
6const collection = database.collection("history");
7
8for (let i = 0; i < 100; i++) {
9 // Select a type
Skyler Grey11236ba2022-08-08 21:13:33 +010010 let type = ["join", "unban", "leave", "ban", "softban", "kick", "mute", "purge", "warn", "nickname"][
11 Math.floor(Math.random() * 9)
12 ];
pineafan4edb7762022-06-26 19:21:04 +010013 // Select a random date in the last year
TheCodedProf6ec331b2023-02-20 12:13:06 -050014 let date = new Date(Date.now() - Math.floor(Math.random() * 31536000000));
pineafan4edb7762022-06-26 19:21:04 +010015 // Add to database
16 await collection.insertOne({
17 type: type,
18 occurredAt: date,
19 user: "438733159748599813",
20 guild: "864185037078790195",
Skyler Grey11236ba2022-08-08 21:13:33 +010021 moderator: ["unban", "ban", "softban", "kick", "mute", "purge", "warn"].includes(type)
Skyler Grey75ea9172022-08-06 10:22:23 +010022 ? "438733159748599813"
23 : null,
Skyler Grey11236ba2022-08-08 21:13:33 +010024 reason: ["unban", "ban", "softban", "kick", "mute", "purge", "warn"].includes(type) ? "Test" : null,
Skyler Grey75ea9172022-08-06 10:22:23 +010025 before: type === "nickname" ? "TestBefore" : null,
26 after: type === "nickname" ? "TestAfter" : null,
27 amount: type === "purge" ? Math.floor(Math.random() * 100) : null
pineafan4edb7762022-06-26 19:21:04 +010028 });
29 console.log("Inserted document " + i);
30}