I need my bot to save user violations to a database when a user uses a command. For example, when #violate @user red light pass
is used, the bot should save the red light pass to the database for the mentioned user. I'm using Repl.it's database and this is my code:
client.on("message", async message => {
if (message.content.toLowerCase().startsWith("#violations")) {
let violation = await db.get(`wallet_${message.author.id}`)
if (violation === null) violation = "you dont have any tickets"
let pembed = new Discord.MessageEmbed()
.setTitle(`${message.author.username} violations`)
.setDescription(`المخالفات المرورية : ${violation}`)
.setColor("RANDOM")
.setFooter("L.S.P.D")
message.channel.send(pembed)
}
if (message.channel.id === '844933512514633768') {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
console.log(args);
const command = args.shift().toLowerCase();
if (command == 'red light pass') {
const member = message.mentions.members.first(); //
let light = "red lightpass"
await db.set(`wallet_${memeber}`, light)
}
}
})