#discord.js txt file write in

14 messages · Page 1 of 1 (latest)

lofty crest
#

.

mint boneBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

tiny jolt
#

what

lofty crest
#

sorry

#

wait

waxen crag
#

Please try to put your question in a complete sentence and add context to explain what you try to do

lofty crest
#
client.on('message', function(message) {
  if (message.content.startsWith("+" + "sell")) {
    var json = JSON.stringify(obj);
      const line = fs.readFileSync("sells.txt", "utf8").split("\n").length
     let args = message.content.trim().split(/ +/g);;
     const link = args.slice(1).join(' ');
    const content = `${line} \n${link}`
      fs.writeFileSync("sells.txt", JSON.stringify(content));
  }});
  1. This is my code.
    2.) Version: Discord.js Version 12

I need help. I want that when running this command like "+sell <@User> <Product>" that in the sells.txt file is in Line 1 "1234566789 <= (user id as example) | product123 <= (the product as example)"

Then when running the command again that in Line 1 is "84183191002 | productABC" and in Line 2 "1234566789 <= (user id as example) | product123 <= (the product as example)"

#

@waxen crag @tiny jolt

tall hemlockBOT
#

Version 14 has released! Please update at your earliest convenience.
• Update: npm rm discord.js npm i discord.js
Update guide (use CTRL + F to search for the old method or property)

waxen crag
#

v12 is unsupported and will soon stop working completely

lofty crest
#

but my whole code is in v12

lofty crest
#

nooooo

waxen crag
#

It‘s been deprecated for almost two years now