-
-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Labels
questionFurther information is requestedFurther information is requested
Description
I added this to zdiscordAs\server\commands\qb-inventory.js :
const mysql = require('mysql2/promise');
// Database configuration
const dbConfig = {
host: "",
user: "",
password: "",
database: ""
};
module.exports = {
name: "inventory",
description: "Manage player's in-city items",
role: "admin",
options: [{
type: "SUB_COMMAND",
name: "wipeinventory",
description: "Wipe a player's inventory by citizenid",
options: [
{
name: "citizenid",
description: "Player's citizenid",
required: true,
type: "STRING",
},
],
},
],
run: async (client, interaction, args) => {
const amount = args.count || 1;
// ... (your existing code for 'give', 'take', 'inspect')
else if (args.wipeinventory) {
const citizenid = args.citizenid;
try {
const connection = await mysql.createConnection(dbConfig);
const [result] = await connection.execute(
"UPDATE `players` SET `inventory` = '[]' WHERE `citizenid` = ?",
[citizenid]
);
if (result.affectedRows > 0) {
client.utils.log.info(`[${interaction.member.displayName}] wiped inventory of player with citizenid: ${citizenid}`);
interaction.reply({ content: `Inventory wiped for player with citizenid: ${citizenid} (offline/online)`, ephemeral: false });
} else {
interaction.reply({ content: "No player found with that citizenid.", ephemeral: true });
}
await connection.end();
} catch (error) {
console.error("Error wiping inventory:", error);
interaction.reply({ content: "An error occurred while wiping the inventory.", ephemeral: true });
}
}
},
};
and i got this error :
i did yarn cache clean and script doesn't start
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested
