begin guild specific data
This commit is contained in:
6 files changed
+182
-114
No files matched your search
+4
-4
@@ -1,5 +1,5 @@
|
||||
const { MessageEmbed, } = require('discord.js');
|
||||
const Inventory = require('../structures/inventory');
|
||||
const { Inventory, addInventory } = require('../structures/inventory');
|
||||
|
||||
module.exports = {
|
||||
name: "work",
|
||||
@@ -42,11 +42,11 @@ module.exports = {
|
||||
|
||||
if (!inventory) {
|
||||
// if the inventory previously didn't exists, this is the only information we require
|
||||
inventory = {lastWork: new Date('2000-01-01T00:00:00')} // Early date ensures they can work
|
||||
inventory = {guilds: {[guillDB.serverID]: {lastWork: new Date('2000-01-01T00:00:00')}}} // Early date ensures they can work
|
||||
|
||||
// Register inventory for user
|
||||
let newInventory = new Inventory();
|
||||
newInventory.createInventory(interaction.member.user.id);
|
||||
newInventory.createInventory(interaction.member.user.id, guildDB.serverID);
|
||||
newInventory.save()
|
||||
.catch(err => {
|
||||
if (err) {
|
||||
@@ -117,7 +117,7 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
|
||||
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id}, {$set: {'inventory.lastWork': now}}, function(err, res) {
|
||||
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id}, {$set: {[`inventory.guilds.${guildDB.serverID}.lastWork`]: now}}, function(err, res) {
|
||||
if (err) {
|
||||
client.log(err);
|
||||
const embed = new MessageEmbed()
|
||||
|
||||
Reference in new issue
Block a user