mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-14 21:26:54 +00:00
Inventory update, added the 'buy', 'shop', 'work', 'rank', and 'inventory' commands
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||
const mongouri = process.env.MONGODB_URI; //DO NOT RUN LOCALLY (no process.env)
|
||||
|
||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||
let collectiontemp;
|
||||
client.connect(err => {
|
||||
collectiontemp = client.db("main").collection("shop");
|
||||
// perform actions on the collection object
|
||||
collectiontemp.insertMany(
|
||||
[{ name: 'Grapes', cost: 2, icon: '🍇', sect: 'Food' },
|
||||
{ name: 'Melon', cost: 5, icon: '🍈', sect: 'Food' },
|
||||
{ name: 'Watermelon', cost: 5, icon: '🍉', sect: 'Food' },
|
||||
{ name: 'Tangerine', cost: 3, icon: '🍊', sect: 'Food' },
|
||||
{ name: 'Lemon', cost: 3, icon: '🍋', sect: 'Food' },
|
||||
{ name: 'Banana', cost: 4, icon: '🍌', sect: 'Food' },
|
||||
{ name: 'Pineapple', cost: 4, icon: '🍍', sect: 'Food' },
|
||||
{ name: 'Mango', cost: 3, icon: '🥭', sect: 'Food' },
|
||||
{ name: 'Red Apple', cost: 3, icon: '🍎', sect: 'Food' },
|
||||
{ name: 'Green Apple', cost: 3, icon: '🍏', sect: 'Food' },
|
||||
{ name: 'Pear', cost: 3, icon: '🍐', sect: 'Food' },
|
||||
{ name: 'Peach', cost: 3, icon: '🍑', sect: 'Food' },
|
||||
{ name: 'Cherries', cost: 4, icon: '🍒', sect: 'Food' },
|
||||
{ name: 'Strawberry', cost: 3, icon: '🍓', sect: 'Food' },
|
||||
{ name: 'Blueberries', cost: 3, icon: '🫐', sect: 'Food' },
|
||||
{ name: 'Kiwi', cost: 3, icon: '🥝', sect: 'Food' },
|
||||
{ name: 'Tomato', cost: 4, icon: '🍅', sect: 'Food' },
|
||||
{ name: 'Olive', cost: 4, icon: '🫒', sect: 'Food' },
|
||||
{ name: 'Coconut', cost: 3, icon: '🥥', sect: 'Food' },
|
||||
{ name: 'Avocado', cost: 3, icon: '🥑', sect: 'Food' },
|
||||
{ name: 'Eggplant', cost: 10, icon: '🍆', sect: 'Food' },
|
||||
{ name: 'Potato', cost: 3, icon: '🥔', sect: 'Food' },
|
||||
{ name: 'Carrot', cost: 3, icon: '🥕', sect: 'Food' },
|
||||
{ name: 'Ear of Corn', cost: 3, icon: '🌽', sect: 'Food' },
|
||||
{ name: 'Hot Pepper', cost: 3, icon: '🌶️', sect: 'Food' },
|
||||
{ name: 'Bell Pepper', cost: 3, icon: '🫑', sect: 'Food' },
|
||||
{ name: 'Cucumber', cost: 3, icon: '🥒', sect: 'Food' },
|
||||
{ name: 'Leafy Green', cost: 3, icon: '🥬', sect: 'Food' },
|
||||
{ name: 'Broccoli', cost: 2, icon: '🥦', sect: 'Food' },
|
||||
{ name: 'Garlic', cost: 3, icon: '🧄', sect: 'Food' },
|
||||
{ name: 'Onion', cost: 3, icon: '🧅', sect: 'Food' },
|
||||
{ name: 'Mushroom', cost: 3, icon: '🍄', sect: 'Food' },
|
||||
{ name: 'Peanuts', cost: 4, icon: '🥜', sect: 'Food' },
|
||||
{ name: 'Chestnut', cost: 3, icon: '🌰', sect: 'Food' },
|
||||
{ name: 'Bread', cost: 5, icon: '🍞', sect: 'Food' },
|
||||
{ name: 'Croissant', cost: 7, icon: '🥐', sect: 'Food' },
|
||||
{ name: 'Baguette Bread', cost: 10, icon: '🥖', sect: 'Food' },
|
||||
{ name: 'Flatbread', cost: 9, icon: '🫓', sect: 'Food' },
|
||||
{ name: 'Pretzel', cost: 5, icon: '🥨', sect: 'Food' },
|
||||
{ name: 'Bagel', cost: 4, icon: '🥯', sect: 'Food' },
|
||||
{ name: 'Pancakes', cost: 5, icon: '🥞', sect: 'Food' },
|
||||
{ name: 'Waffle', cost: 5, icon: '🧇', sect: 'Food' },
|
||||
{ name: 'Cheese Wedge', cost: 3, icon: '🧀', sect: 'Food' },
|
||||
{ name: 'Meat on the Bone', cost: 5, icon: '🍖', sect: 'Food' },
|
||||
{ name: 'Checken Leg', cost: 5, icon: '🍗', sect: 'Food' },
|
||||
{ name: 'Cut of Meat', cost: 4, icon: '🥩', sect: 'Food' },
|
||||
{ name: 'Bacon', cost: 4, icon: '🥓', sect: 'Food' },
|
||||
{ name: 'Hamburger', cost: 5, icon: '🍔', sect: 'Food' },
|
||||
{ name: 'French Fries', cost: 3, icon: '🍟', sect: 'Food' },
|
||||
{ name: 'Pizza', cost: 6, icon: '🍕', sect: 'Food' },
|
||||
{ name: 'Hot Dog', cost: 3, icon: '🌭', sect: 'Food' },
|
||||
{ name: 'Sandwich', cost: 3, icon: '🥪', sect: 'Food' },
|
||||
{ name: 'Taco', cost: 3, icon: '🌮', sect: 'Food' },
|
||||
{ name: 'Burrito', cost: 5, icon: '🌯', sect: 'Food' },
|
||||
{ name: 'Tamale', cost: 5, icon: '🫔', sect: 'Food' },
|
||||
{ name: 'Stuffed Flatbread', cost: 5, icon: '🥙', sect: 'Food' },
|
||||
{ name: 'Falafel', cost: 4, icon: '🧆', sect: 'Food' },
|
||||
{ name: 'Egg', cost: 3, icon: '🥚', sect: 'Food' },
|
||||
{ name: 'Hot Pot', cost: 12, icon: '🍲', sect: 'Food' },
|
||||
{ name: 'Fondue', cost: 8, icon: '🫕', sect: 'Food' },
|
||||
{ name: 'Green Salad', cost: 3, icon: '🥗', sect: 'Food' },
|
||||
{ name: 'Popcorn', cost: 3, icon: '🍿', sect: 'Food' },
|
||||
{ name: 'Butter', cost: 2, icon: '🧈', sect: 'Food' },
|
||||
{ name: 'Salt', cost: 2, icon: '🧂', sect: 'Food' },
|
||||
{ name: 'Canned Food', cost: 3, icon: '🥫', sect: 'Food' },
|
||||
{ name: 'Bento Box', cost: 7, icon: '🍱', sect: 'Food' },
|
||||
{ name: 'Rice Cracker', cost: 1, icon: '🍘', sect: 'Food' },
|
||||
{ name: 'Rice Ball', cost: 3, icon: '🍙', sect: 'Food' },
|
||||
{ name: 'Cooked Rice', cost: 3, icon: '🍚', sect: 'Food' },
|
||||
{ name: 'Curry Rice', cost: 4, icon: '🍛', sect: 'Food' },
|
||||
{ name: 'Ramen', cost: 4, icon: '🍜', sect: 'Food' },
|
||||
{ name: 'Spaghetti', cost: 5, icon: '🍝', sect: 'Food' },
|
||||
{ name: 'Roasted Sweet Potato', cost: 3, icon: '🍠', sect: 'Food' },
|
||||
{ name: 'Oden', cost: 3, icon: '🍢', sect: 'Food' },
|
||||
{ name: 'Sushi', cost: 4, icon: '🍣', sect: 'Food' },
|
||||
{ name: 'Fried Shrimp', cost: 3, icon: '🍤', sect: 'Food' },
|
||||
{ name: 'Fish Cake', cost: 3, icon: '🍥', sect: 'Food' },
|
||||
{ name: 'Moon Cake', cost: 3, icon: '🥮', sect: 'Food' },
|
||||
{ name: 'Dango', cost: 3, icon: '🍡', sect: 'Food' },
|
||||
{ name: 'Dumpling', cost: 3, icon: '🥟', sect: 'Food' },
|
||||
{ name: 'Fortune Cookie', cost: 3, icon: '🥠', sect: 'Food' },
|
||||
{ name: 'Oyster', cost: 4, icon: '🦪', sect: 'Food' },
|
||||
{ name: 'Ice Cream Cone', cost: 3, icon: '🍦', sect: 'Food' },
|
||||
{ name: 'Shaved Ice', cost: 3, icon: '🍧', sect: 'Food' },
|
||||
{ name: 'Ice Cream', cost: 3, icon: '🍨', sect: 'Food' },
|
||||
{ name: 'Doughnut', cost: 3, icon: '🍩', sect: 'Food' },
|
||||
{ name: 'Cookie', cost: 3, icon: '🍪', sect: 'Food' },
|
||||
{ name: 'Birthday Cake', cost: 7, icon: '🎂', sect: 'Food' },
|
||||
{ name: 'Shortcake', cost: 4, icon: '🍰', sect: 'Food' },
|
||||
{ name: 'Cupcake', cost: 3, icon: '🧁', sect: 'Food' },
|
||||
{ name: 'Pie', cost: 4, icon: '🥧', sect: 'Food' },
|
||||
{ name: 'Chocolate Bar', cost: 2, icon: '🍫', sect: 'Food' },
|
||||
{ name: 'Candy', cost: 1, icon: '🍬', sect: 'Food' },
|
||||
{ name: 'Lollipop', cost: 1, icon: '🍭', sect: 'Food' },
|
||||
{ name: 'Custard', cost: 3, icon: '🍮', sect: 'Food' },
|
||||
{ name: 'Honey Pot', cost: 3, icon: '🍯', sect: 'Food' },
|
||||
{ name: 'Baby Bottle', cost: 3, icon: '🍼', sect: 'Food' },
|
||||
{ name: 'Glass of Milk', cost: 3, icon: '🥛', sect: 'Food' },
|
||||
{ name: 'Coffee', cost: 3, icon: '☕', sect: 'Food' },
|
||||
{ name: 'Teapot', cost: 3, icon: '🫖', sect: 'Food' },
|
||||
{ name: 'Tea', cost: 3, icon: '🍵', sect: 'Food' },
|
||||
{ name: 'Sake', cost: 3, icon: '🍶', sect: 'Food' },
|
||||
{ name: 'Champagne', cost: 3, icon: '🍾', sect: 'Food' },
|
||||
{ name: 'Wine Glass', cost: 3, icon: '🍷', sect: 'Food' },
|
||||
{ name: 'Cocktail Glass', cost: 3, icon: '🍸', sect: 'Food' },
|
||||
{ name: 'Tropical Drink', cost: 3, icon: '🍹', sect: 'Food' },
|
||||
{ name: 'Beer Mug', cost: 3, icon: '🍺', sect: 'Food' },
|
||||
{ name: 'Tumbler', cost: 3, icon: '🥃', sect: 'Food' },
|
||||
{ name: 'Soda', cost: 3, icon: '🥤', sect: 'Food' },
|
||||
{ name: 'Bubble Tea', cost: 3, icon: '🧋', sect: 'Food' },
|
||||
{ name: 'Beverage Box', cost: 30, icon: '🧃', sect: 'Food' },
|
||||
{ name: 'Mate', cost: 3, icon: '🧉', sect: 'Food' }]);
|
||||
});
|
||||
|
||||
client.close();
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
2: 60 up 60
|
||||
3: 80 up 20
|
||||
4: 100 up 20
|
||||
5: 140 up 40
|
||||
6: 160 up 20
|
||||
7: 200 up 40
|
||||
8: 220 up 20
|
||||
9: 260 up 40
|
||||
10: 300 up 40
|
||||
11: 340 up 40
|
||||
12: 400 up 60
|
||||
13: 440 up 40
|
||||
14: 500 up 60
|
||||
15: 580 up 80
|
||||
16: 660 up 80
|
||||
17: 760 up 100
|
||||
18: 860 up 100
|
||||
19: 980 up 120
|
||||
20: 1140 up 160
|
||||
21: 1320 up 180
|
||||
22: 1520 up 200
|
||||
23: 1780 up 260
|
||||
24: 2080 up 300
|
||||
25: 2440 up 360
|
||||
26: 2860 up 420
|
||||
27: 3380 up 520
|
||||
28: 3980 up 600
|
||||
29: 4720 up 740
|
||||
30: 5620 up 900
|
||||
31: 6700 up 1080
|
||||
32: 8000 up 1300
|
||||
33: 9560 up 1560
|
||||
34: 11460 up 1900
|
||||
35: 13740 up 2280
|
||||
36: 16500 up 2760
|
||||
37: 19840 up 3340
|
||||
38: 23880 up 4040
|
||||
39: 28760 up 4880
|
||||
40: 34640 up 5880
|
||||
41: 41780 up 7140
|
||||
42: 50400 up 8620
|
||||
43: 60840 up 10440
|
||||
44: 73440 up 12600
|
||||
45: 88700 up 15260
|
||||
46: 107180 up 18480
|
||||
47: 129500 up 22320
|
||||
48: 156520 up 27020
|
||||
49: 189220 up 32700
|
||||
50: 228760 up 39540
|
||||
51: 276620 up 47860
|
||||
52: 334520 up 57900
|
||||
53: 404580 up 70060
|
||||
54: 489340 up 84760
|
||||
55: 591880 up 102540
|
||||
56: 715980 up 124100
|
||||
57: 866120 up 150140
|
||||
58: 1047780 up 181660
|
||||
59: 1267600 up 219820
|
||||
60: 1533580 up 265980
|
||||
61: 1855400 up 321820
|
||||
62: 2244780 up 389380
|
||||
63: 2715960 up 471180
|
||||
64: 3286060 up 570100
|
||||
65: 3975900 up 689840
|
||||
66: 4810580 up 834680
|
||||
67: 5820540 up 1009960
|
||||
68: 7042600 up 1222060
|
||||
69: 8521280 up 1478680
|
||||
70: 10310480 up 1789200
|
||||
71: 12475420 up 2164940
|
||||
72: 15094980 up 2619560
|
||||
73: 18264640 up 3169660
|
||||
74: 22099940 up 3835300
|
||||
75: 26740620 up 4640680
|
||||
76: 32355860 up 5615240
|
||||
77: 39150300 up 6794440
|
||||
78: 47371560 up 8221260
|
||||
79: 57319280 up 9947720
|
||||
80: 69356020 up 12036740
|
||||
81: 83920480 up 14564460
|
||||
82: 101543460 up 17622980
|
||||
83: 122867260 up 21323800
|
||||
84: 148669060 up 25801800
|
||||
85: 179889240 up 31220180
|
||||
86: 217665640 up 37776400
|
||||
87: 263375080 up 45709440
|
||||
88: 318683520 up 55308440
|
||||
89: 385606700 up 66923180
|
||||
90: 466583760 up 80977060
|
||||
91: 564566000 up 97982240
|
||||
92: 683124500 up 118558500
|
||||
93: 826580280 up 143455780
|
||||
94: 1000161760 up 173581480
|
||||
95: 1210195360 up 210033600
|
||||
96: 1464336000 up 254140640
|
||||
97: 1771846200 up 307510200
|
||||
98: 2143933500 up 372087300
|
||||
99: 2594159160 up 450225660
|
||||
100: 3138932180 up 544773020
|
||||
101: 3798107540 up 659175360
|
||||
@@ -0,0 +1,259 @@
|
||||
const { db } = require('./guild');
|
||||
const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||
// const { update } = require('apt');
|
||||
const { Collection, Client, Formatters, Intents } = require('discord.js');
|
||||
const BASE_PAY = 5;
|
||||
const BASE_LVL_XP = 35;
|
||||
//Note that leveling up to the next level takes 10% more xp than the previous one
|
||||
|
||||
|
||||
//#region functions
|
||||
|
||||
function isNum(arg) {
|
||||
return (!isNaN(arg) && Number.isSafeInteger(Number(arg)));
|
||||
};
|
||||
|
||||
|
||||
function addxp(message, dbo, amt, xp_list) {
|
||||
if (!isNum(amt)) { return console.log("This isn't a number...."); }
|
||||
|
||||
dbo.find({"balance": {$exists: true}}).toArray(function(err, doc) {
|
||||
if (!String(doc)) { return console.log("ERROR!\nThis account does not exist!"); }
|
||||
|
||||
temp = doc[0];
|
||||
let rank = temp.rank + 1;
|
||||
const txp = temp.xp + amt;
|
||||
//If the rank is less than 100, you can still advance
|
||||
if (rank < 101) {
|
||||
let needed = xp_list.get(rank);
|
||||
if (txp >= needed) {
|
||||
//Get to the max level possible with the current xp (may skip)
|
||||
while (txp >= needed) {
|
||||
rank ++;
|
||||
needed = xp_list.get(rank);
|
||||
}
|
||||
rank --; //Maybe?
|
||||
dbo.updateOne({balance: temp.balance, rank: temp.rank, lastdayworked: temp.lastdayworked}, { $set: { rank: rank }});
|
||||
message.channel.send('Congradulations <@' + message.author.id + '> for reaching rank ' + String(rank) + '!');
|
||||
}
|
||||
}
|
||||
|
||||
dbo.updateOne({balance: temp.balance}, { $set: { xp: txp}});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function rank(dbo, message, xp_list) {
|
||||
dbo.find({"balance": {$exists: true}}).toArray(function(err, doc) {
|
||||
if (!String(doc)) { return console.log("ERROR!\nThis account does not exist!"); }
|
||||
|
||||
let next = doc[0].rank + 1;
|
||||
let needed = xp_list.get(next);
|
||||
|
||||
message.channel.send('<@' + message.author.id + '> you are currently at rank ' + String(next-1) + ' and have ' + String(doc[0].xp) + 'xp. You need ' + String(needed - doc[0].xp) + ' more xp to get to rank ' + String(next));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Changes one type of currency for another
|
||||
function convertCurrency(id, amt, dbo) {
|
||||
|
||||
}
|
||||
|
||||
function checkAndUpdateBal(dbo, item, message, args) {
|
||||
let b = false;
|
||||
dbo.find({"balance": {$exists: true}}).toArray(b = function(err, doc) {
|
||||
if (!String(doc)) { return message.reply("Your account doesn't exist, please contact the mods for support"); }
|
||||
|
||||
const icost = args[0] * item.cost;
|
||||
if (doc[0].balance < icost) {
|
||||
message.reply("Insufficient funds!");
|
||||
return false;
|
||||
} else {
|
||||
let temp = doc[0];
|
||||
dbo.updateOne({balance: temp.balance, rank: temp.rank, lastdayworked: temp.lastdayworked}, { $set: { balance: doc[0].balance -= icost }});
|
||||
message.reply("You have bought " + item.name + " for " + icost + "!");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
function buy(id, message, args, dbo, shop, xp_list) {
|
||||
if (args.length < 2) { return; }
|
||||
if (!isNum(args[0])) { return message.reply("Please enter a number for query 2"); }
|
||||
|
||||
let query = args[1];
|
||||
let item = shop.filter(function (item) { return item.name.toLowerCase() == query.toLowerCase(); });
|
||||
|
||||
if (!String(item)) { return message.reply("This item does not exist!"); }
|
||||
|
||||
let success = Boolean(checkAndUpdateBal(dbo, item[0], message, args));
|
||||
if (!success) { return; }
|
||||
|
||||
var newObj = { name: item[0].name, cost: item[0].cost, icon: item[0].icon, sect: item[0].sect};
|
||||
|
||||
addxp(message, dbo, Math.ceil(item[0].cost * 1.2), xp_list);
|
||||
dbo.find(newObj, {$exists: true}).toArray(function(err, doc) {
|
||||
if(String(doc)) {
|
||||
let newnum = doc[0].num + Number(args[0]);
|
||||
console.log(newnum);
|
||||
dbo.updateOne({ name: item[0].name }, {$set: {num: newnum}});
|
||||
} else {
|
||||
dbo.insertOne({ name: item[0].name, cost: item[0].cost, icon: item[0].icon, sect: item[0].sect, num: Number(args[0])});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function sell(id, message, args, dbo, shop) {
|
||||
if (args.length < 2) { return; }
|
||||
if (!isNum(args[0])) { return message.reply("Please enter a number for query 2"); }
|
||||
var newObj = { name: args[1] };
|
||||
|
||||
let query = args[1];
|
||||
let item = shop.filter(function (item) { return item.name.toLowerCase() == query.toLowerCase(); });
|
||||
if (!String(item)) { return message.reply("This item does not exist!"); }
|
||||
if (!success) { return; }
|
||||
|
||||
dbo.find(newObj, {$exists: true}).toArray(function(err, doc) {
|
||||
return console.log(String(doc));
|
||||
if(String(doc)) {
|
||||
dbo.updateOne({ name: args[1] }, {$set: {num: doc[0].num + Number(args[0])}});
|
||||
} else {
|
||||
message.reply("You don't own this item!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function work(dbo, message, xp_list) {
|
||||
let fulldate = new Date();
|
||||
let date = fulldate.getDate();
|
||||
dbo.find({"lastdayworked": {$exists: true}}).toArray(function(err, doc) {
|
||||
if (!String(doc)) { return message.reply("Your account doesn't exist, please contact the mods for support"); }
|
||||
if (doc[0].lastdayworked == date) {
|
||||
message.reply("You've already worked today, try again tomorrow!");
|
||||
} else {
|
||||
//Amount to be paid
|
||||
let amt = 0;
|
||||
amt = BASE_PAY * doc[0].rank;
|
||||
dbo.updateOne({balance: doc[0].balance, rank: doc[0].rank}, { $set: { balance: amt, lastdayworked: date }});
|
||||
addxp(message, dbo, Math.ceil(amt*1.5), xp_list);
|
||||
message.channel.send('<@' + message.author.id + '> worked and earned $' + amt +' and ' + Math.ceil(amt*1.5) + ' xp!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function printInventory(dbo, message) {
|
||||
let tempstring = "";
|
||||
dbo.find().toArray(function(err, docs){
|
||||
docs.forEach(val => {
|
||||
if (!val.balance) {
|
||||
tempstring += String(val.num) + " " + val.name + " (" + val.icon + ")\n";
|
||||
}
|
||||
});
|
||||
message.reply(tempstring);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getShop(message, args, items) {
|
||||
if (args.length == 0) {
|
||||
let temp = Formatters.codeBlock(items.map(i => `${i.sect}`).join(' '));
|
||||
temp = [...new Set(temp.split(' '))];
|
||||
|
||||
return message.reply("Please use the format /shop [type] [page number]\nTypes are: " + temp);
|
||||
}
|
||||
|
||||
let ind = 1;
|
||||
let noinp = false;
|
||||
if (args.length > 1) {
|
||||
if (args[1] < (items.length / 9)) {
|
||||
ind = Number(args[1]);
|
||||
} else {
|
||||
return message.reply("That number is too large");
|
||||
}
|
||||
} else {
|
||||
noinp = true;
|
||||
}
|
||||
|
||||
const items2 = items.slice((ind - 1)*10, (ind - 1)*10+10);
|
||||
newText = Formatters.codeBlock(items2.map(i => `${i.icon} (${i.name}): \$${i.cost}`)
|
||||
.filter(f => f.sect = args[0]).join('\n'));
|
||||
|
||||
if (noinp) {
|
||||
newText += "(Use /shop [type] [page number] to access other pages)";
|
||||
}
|
||||
|
||||
return message.reply(newText);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//Main Code
|
||||
module.exports = {
|
||||
name: 'ECON',
|
||||
description: 'ECON',
|
||||
async execute(bot, message, args, command, Discord, mongouri, items, xp_list) {
|
||||
//Set Discord vars
|
||||
const id = message.author.id;
|
||||
const server = message.guild.id;
|
||||
|
||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||
client.connect(err => {
|
||||
const db = client.db(server);
|
||||
const dbo = db.collection(id);
|
||||
if (err) { return console.log(err); }
|
||||
//Initialize if necessary
|
||||
db.listCollections({name: id})
|
||||
.next(function(err, collinfo) {
|
||||
if (!collinfo) {
|
||||
message.reply("You didn't have a place in my databases, so I created one for you!\nPlease try your command again!")
|
||||
dbo.insertOne({balance: 100, rank: 1, lastdayworked: 0, xp: 0});
|
||||
return;
|
||||
}
|
||||
|
||||
//test area
|
||||
if (command == 'xp' || command == 'adbal') {
|
||||
if (message.member.roles.cache.has('944048889038774302')) {
|
||||
if (command == 'xp') {
|
||||
return addxp(message, dbo, Number(args[0]), xp_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Command Area
|
||||
if(command == 'init') {
|
||||
//Add security check here
|
||||
// init.execute(bot, message, args, command, dbo, Discord, connect);
|
||||
return;
|
||||
} else if (command == 'checkinv') {
|
||||
const req = dbo.findOne({ id: message.guild.id });
|
||||
if (!req) { return message.reply("Doc doesn't exist!"); }
|
||||
} else if (command == 'buy') {
|
||||
buy(id, message, args, dbo, items, xp_list);
|
||||
} else if (command == 'shop') {
|
||||
getShop(message, args, items);
|
||||
} else if (command == 'work') {
|
||||
work(dbo, message, xp_list);
|
||||
} else if (command == 'rank') {
|
||||
rank(dbo, message, xp_list);
|
||||
} else if (command == 'inventory') {
|
||||
printInventory(dbo, message);
|
||||
} else {
|
||||
message.channel.send("'" + message.content + "' is not a command!");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
//Close the database
|
||||
client.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
const { Schema, model } = require('mongoose');
|
||||
|
||||
const Guild = Schema({
|
||||
id: String,
|
||||
prefix: {
|
||||
default: '?',
|
||||
type: String
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = model('Guild', Guild);
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
name: 'Init',
|
||||
async execute(bot, message, args, command, GuildModel, Discord, connect) {
|
||||
if (!message.guild) { return console.log("NO GUILD"); }
|
||||
const doc = new GuildModel( {id: message.guild.id });
|
||||
await doc.save();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
const { Client, Intents } = require('discord.js');
|
||||
const Discord = require('discord.js');
|
||||
const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||
const fs = require('fs');
|
||||
const { exit } = require('process');
|
||||
const BASE_LVL_XP = 20;
|
||||
|
||||
// const { token } = require('./config.json');
|
||||
//Heroku part
|
||||
// const { token } = process.env.token;
|
||||
@@ -17,10 +22,27 @@ const prefix = '/';
|
||||
|
||||
|
||||
//MongoDB integration
|
||||
const uri = process.env.MONGODB_URI;
|
||||
const mongouri = "mongodb+srv://discordbot:Nivi8395@bot.t5ghb.mongodb.net/myFirstDatabase?retryWrites=true";//process.env.MONGODB_URI;
|
||||
const GuildModel = require('./commands/inventory/models/guild');
|
||||
const { connect } = require('mongoose');
|
||||
|
||||
|
||||
bot.on("guildCreate", guild => {
|
||||
// guild.owner.send('Thanks! You can use +help to discover commands.')
|
||||
|
||||
//Get total inventory
|
||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||
client.connect(err => {
|
||||
const collection = client.db(guild).collection("shop");
|
||||
// perform actions on the collection object
|
||||
console.log(guild);
|
||||
client.close();
|
||||
});
|
||||
});
|
||||
|
||||
//MongoDB Integration end
|
||||
// let item = items.filter(function (item) { return item.name.toLowerCase() == 'grapes'; });
|
||||
|
||||
const fs = require('fs');
|
||||
const { exit } = require('process');
|
||||
bot.commands = new Discord.Collection();
|
||||
|
||||
bot.commNames = new Discord.Collection();
|
||||
@@ -40,25 +62,44 @@ for (const file of commandFiles) {
|
||||
i ++;
|
||||
}
|
||||
|
||||
// const econFiles = fs.readdirSync('./commands/currency').filter(file => file.endsWith('.js'));;
|
||||
// const econFiles = fs.readdirSync('./commands/inventory').filter(file => file.endsWith('.js'));;
|
||||
// ECON SECTION
|
||||
// bot.commands.set('ECON', require(`./commands/currency/app.js`));
|
||||
bot.commands.set('ECON', require(`./commands/inventory/models/app`));
|
||||
// const currency = new Discord.Collection();
|
||||
// const { Users } = require('./commands/currency/dbObjects.js');
|
||||
// i++;
|
||||
|
||||
bot.commNames.set('length', i);
|
||||
|
||||
//XP Table section
|
||||
let xp_collection = new Map();
|
||||
let items;
|
||||
|
||||
bot.on('ready', async () => {
|
||||
// bot.once('ready', async () => {
|
||||
// Another Econ Section
|
||||
// const storedBalances = await Users.findAll();
|
||||
// storedBalances.forEach(b => currency.set(b.user_id, b));
|
||||
//Make then copy the shop
|
||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
||||
client.connect(err => {
|
||||
const shop = client.db("main").collection("shop");
|
||||
shop.find().toArray(function(err, itemstemp) {
|
||||
if (err) throw err;
|
||||
|
||||
items = [...itemstemp];
|
||||
|
||||
client.close();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//XP section (start at 2 bc you're already at lvl 1)
|
||||
//Note the xp numbers are a little wonky on levels 6, 8 and 13 (why though?)
|
||||
//See https://stackoverflow.com/questions/72212928/why-are-the-differences-between-my-numbers-inconsistent-sort-of-compund-interes
|
||||
for (let i = 1; i < 101; i ++) {
|
||||
// xp_collection.set(i, BASE_LVL_XP * .1);
|
||||
let amount = BASE_LVL_XP * (Math.ceil(Math.pow((1.1), (2 * i))) + i);
|
||||
xp_collection.set(i+1, amount);
|
||||
}
|
||||
|
||||
// console.log(`Logged in as ${bot.user.tag}!`);
|
||||
console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!');
|
||||
console.log("Look into integrating MySQL into SelmerBot instead of SQLite");
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +110,6 @@ bot.on('messageCreate', (message) => {
|
||||
|
||||
const args = message.content.slice(prefix.length).split(' ');
|
||||
const command = args.shift().toLowerCase();
|
||||
|
||||
|
||||
//Check if the user has sufficient permission
|
||||
//Performes the command
|
||||
@@ -101,7 +141,7 @@ bot.on('messageCreate', (message) => {
|
||||
case 'kareoke': bot.commands.get('kareoke').execute(message, args);
|
||||
break;
|
||||
|
||||
default: message.channel.send("'" + message.content + "' is not a command!");
|
||||
default: bot.commands.get('ECON').execute(bot, message, args, command, Discord, mongouri, items, xp_collection);
|
||||
//Removed because Heroku doesn't work with sqlite
|
||||
//default: bot.commands.get('ECON').execute(bot, prefix, message, args, command, Users, currency);
|
||||
}
|
||||
@@ -109,5 +149,8 @@ bot.on('messageCreate', (message) => {
|
||||
|
||||
//Look into integrating MySQL into SelmerBot instead of SQLite
|
||||
|
||||
//Last Line
|
||||
bot.login(process.env.token);
|
||||
//Last Line(s)
|
||||
const { token } = require('./config.json');
|
||||
bot.login(token);
|
||||
|
||||
// bot.login(process.env.token);
|
||||
Generated
+409
-9
@@ -19,6 +19,7 @@
|
||||
"ffmpeg-static": "^5.0.0",
|
||||
"hastebin-gen": "^2.0.5",
|
||||
"libsodium-wrappers": "^0.7.10",
|
||||
"mongoose": "^6.3.2",
|
||||
"mysql": "^2.18.1",
|
||||
"node.js": "^0.0.1-security",
|
||||
"play-dl": "^1.9.4",
|
||||
@@ -311,6 +312,20 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.2.tgz",
|
||||
"integrity": "sha512-KFcchQ3h0OPQgFirBRPZr5F/sVjxZsOrQHedj3zi8AH3Zv/hOLx2OLR4hxR5HcfoU+33n69ZuOfzthKVdMoTiw=="
|
||||
},
|
||||
"node_modules/@types/webidl-conversions": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz",
|
||||
"integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
|
||||
},
|
||||
"node_modules/@types/whatwg-url": {
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
|
||||
"integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/webidl-conversions": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
|
||||
@@ -435,6 +450,25 @@
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/bignumber.js": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||
@@ -457,6 +491,40 @@
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bson": {
|
||||
"version": "4.6.3",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.6.3.tgz",
|
||||
"integrity": "sha512-rAqP5hcUVJhXP2MCSNVsf0oM2OGU1So6A9pVRDYayvJ5+hygXHQApf87wd5NlhPM1J9RJnbqxIG/f8QTzRoQ4A==",
|
||||
"dependencies": {
|
||||
"buffer": "^5.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
@@ -651,6 +719,14 @@
|
||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
|
||||
},
|
||||
"node_modules/denque": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz",
|
||||
"integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==",
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
@@ -1026,6 +1102,25 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
@@ -1083,8 +1178,7 @@
|
||||
"node_modules/ip": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
||||
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
|
||||
"optional": true
|
||||
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
@@ -1110,6 +1204,11 @@
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
||||
},
|
||||
"node_modules/kareem": {
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.5.tgz",
|
||||
"integrity": "sha512-qxCyQtp3ioawkiRNQr/v8xw9KIviMSSNmy+63Wubj7KmMn3g7noRXIZB4vPCAP+ETi2SR8eH6CvmlKZuGpoHOg=="
|
||||
},
|
||||
"node_modules/libsodium": {
|
||||
"version": "0.7.10",
|
||||
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
|
||||
@@ -1200,6 +1299,12 @@
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
@@ -1356,6 +1461,108 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.5.0.tgz",
|
||||
"integrity": "sha512-A2l8MjEpKojnhbCM0MK3+UOGUSGvTNNSv7AkP1fsT7tkambrkkqN/5F2y+PhzsV0Nbv58u04TETpkaSEdI2zKA==",
|
||||
"dependencies": {
|
||||
"bson": "^4.6.2",
|
||||
"denque": "^2.0.1",
|
||||
"mongodb-connection-string-url": "^2.5.2",
|
||||
"socks": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.9.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"saslprep": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb-connection-string-url": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz",
|
||||
"integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==",
|
||||
"dependencies": {
|
||||
"@types/whatwg-url": "^8.2.1",
|
||||
"whatwg-url": "^11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb-connection-string-url/node_modules/tr46": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
|
||||
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb-connection-string-url/node_modules/webidl-conversions": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb-connection-string-url/node_modules/whatwg-url": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
|
||||
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
|
||||
"dependencies": {
|
||||
"tr46": "^3.0.0",
|
||||
"webidl-conversions": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/mongoose": {
|
||||
"version": "6.3.2",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.3.2.tgz",
|
||||
"integrity": "sha512-4SEa8ynhJYkGMMbx6KOZ5kJz6qhKIYM8nAGufGq3xh+gNrKP3QwthNfc0X4DvTKhE0DQLMS1/Oy3cMl0AXm5RQ==",
|
||||
"dependencies": {
|
||||
"bson": "^4.6.2",
|
||||
"kareem": "2.3.5",
|
||||
"mongodb": "4.5.0",
|
||||
"mpath": "0.9.0",
|
||||
"mquery": "4.0.2",
|
||||
"ms": "2.1.3",
|
||||
"sift": "16.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/mongoose"
|
||||
}
|
||||
},
|
||||
"node_modules/mongoose/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/mpath": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
|
||||
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mquery": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz",
|
||||
"integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==",
|
||||
"dependencies": {
|
||||
"debug": "4.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
@@ -1666,6 +1873,14 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/read": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
|
||||
@@ -1738,6 +1953,18 @@
|
||||
"truncate-utf8-bytes": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/saslprep": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
|
||||
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
@@ -1828,6 +2055,11 @@
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||
},
|
||||
"node_modules/sift": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz",
|
||||
"integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ=="
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||
@@ -1837,7 +2069,6 @@
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
@@ -1847,7 +2078,6 @@
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
|
||||
"integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"ip": "^1.1.5",
|
||||
"smart-buffer": "^4.2.0"
|
||||
@@ -1871,6 +2101,15 @@
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/sparse-bitfield": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/speedometer": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz",
|
||||
@@ -2493,6 +2732,20 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.2.tgz",
|
||||
"integrity": "sha512-KFcchQ3h0OPQgFirBRPZr5F/sVjxZsOrQHedj3zi8AH3Zv/hOLx2OLR4hxR5HcfoU+33n69ZuOfzthKVdMoTiw=="
|
||||
},
|
||||
"@types/webidl-conversions": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz",
|
||||
"integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
|
||||
},
|
||||
"@types/whatwg-url": {
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
|
||||
"integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
"@types/webidl-conversions": "*"
|
||||
}
|
||||
},
|
||||
"@types/ws": {
|
||||
"version": "8.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
|
||||
@@ -2598,6 +2851,11 @@
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bignumber.js": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||
@@ -2617,6 +2875,23 @@
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"bson": {
|
||||
"version": "4.6.3",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.6.3.tgz",
|
||||
"integrity": "sha512-rAqP5hcUVJhXP2MCSNVsf0oM2OGU1So6A9pVRDYayvJ5+hygXHQApf87wd5NlhPM1J9RJnbqxIG/f8QTzRoQ4A==",
|
||||
"requires": {
|
||||
"buffer": "^5.6.0"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
@@ -2764,6 +3039,11 @@
|
||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
|
||||
},
|
||||
"denque": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz",
|
||||
"integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ=="
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
@@ -3048,6 +3328,11 @@
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
}
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||
},
|
||||
"imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
@@ -3093,8 +3378,7 @@
|
||||
"ip": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
||||
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
|
||||
"optional": true
|
||||
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
@@ -3117,6 +3401,11 @@
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
||||
},
|
||||
"kareem": {
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.5.tgz",
|
||||
"integrity": "sha512-qxCyQtp3ioawkiRNQr/v8xw9KIviMSSNmy+63Wubj7KmMn3g7noRXIZB4vPCAP+ETi2SR8eH6CvmlKZuGpoHOg=="
|
||||
},
|
||||
"libsodium": {
|
||||
"version": "0.7.10",
|
||||
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz",
|
||||
@@ -3191,6 +3480,12 @@
|
||||
"ssri": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"optional": true
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
@@ -3300,6 +3595,85 @@
|
||||
"moment": ">= 2.9.0"
|
||||
}
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.5.0.tgz",
|
||||
"integrity": "sha512-A2l8MjEpKojnhbCM0MK3+UOGUSGvTNNSv7AkP1fsT7tkambrkkqN/5F2y+PhzsV0Nbv58u04TETpkaSEdI2zKA==",
|
||||
"requires": {
|
||||
"bson": "^4.6.2",
|
||||
"denque": "^2.0.1",
|
||||
"mongodb-connection-string-url": "^2.5.2",
|
||||
"saslprep": "^1.0.3",
|
||||
"socks": "^2.6.2"
|
||||
}
|
||||
},
|
||||
"mongodb-connection-string-url": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz",
|
||||
"integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==",
|
||||
"requires": {
|
||||
"@types/whatwg-url": "^8.2.1",
|
||||
"whatwg-url": "^11.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tr46": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
|
||||
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
|
||||
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
|
||||
"requires": {
|
||||
"tr46": "^3.0.0",
|
||||
"webidl-conversions": "^7.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mongoose": {
|
||||
"version": "6.3.2",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.3.2.tgz",
|
||||
"integrity": "sha512-4SEa8ynhJYkGMMbx6KOZ5kJz6qhKIYM8nAGufGq3xh+gNrKP3QwthNfc0X4DvTKhE0DQLMS1/Oy3cMl0AXm5RQ==",
|
||||
"requires": {
|
||||
"bson": "^4.6.2",
|
||||
"kareem": "2.3.5",
|
||||
"mongodb": "4.5.0",
|
||||
"mpath": "0.9.0",
|
||||
"mquery": "4.0.2",
|
||||
"ms": "2.1.3",
|
||||
"sift": "16.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"mpath": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
|
||||
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew=="
|
||||
},
|
||||
"mquery": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz",
|
||||
"integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==",
|
||||
"requires": {
|
||||
"debug": "4.x"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
@@ -3544,6 +3918,11 @@
|
||||
"retry": "^0.12.0"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"read": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
|
||||
@@ -3604,6 +3983,15 @@
|
||||
"truncate-utf8-bytes": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"saslprep": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
|
||||
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
@@ -3650,6 +4038,11 @@
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||
},
|
||||
"sift": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz",
|
||||
"integrity": "sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ=="
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||
@@ -3658,14 +4051,12 @@
|
||||
"smart-buffer": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||
"optional": true
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
|
||||
},
|
||||
"socks": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
|
||||
"integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ip": "^1.1.5",
|
||||
"smart-buffer": "^4.2.0"
|
||||
@@ -3682,6 +4073,15 @@
|
||||
"socks": "^2.6.1"
|
||||
}
|
||||
},
|
||||
"sparse-bitfield": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"speedometer": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.0.0.tgz",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"ffmpeg-static": "^5.0.0",
|
||||
"hastebin-gen": "^2.0.5",
|
||||
"libsodium-wrappers": "^0.7.10",
|
||||
"mongoose": "^6.3.2",
|
||||
"mysql": "^2.18.1",
|
||||
"node.js": "^0.0.1-security",
|
||||
"play-dl": "^1.9.4",
|
||||
|
||||
Reference in New Issue
Block a user