#The bot is silent and does not send me a transcript

47 messages · Page 1 of 1 (latest)

broken otter
#

Code:
(This is my first time working with discord.js, don’t judge me)

$djsEval[(async () => {
  const discordTranscripts = require("discord-html-transcripts");
  const userID = '602842619797569587';
  const channel = client.channels.cache.get("$channelID");
  const attachment = await discordTranscripts.createTranscript(channel, {
      filename: "transcript.html",
      saveImages: true, 
      poweredBy: false,
      number: message.content 
  });
 client.users.cashe.get(userID).send({
    files: [attachment]
  });
})();false]```
solar vergeBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
dapper sky
#

Not all users are cached, fetch instead, and cath the rejection

broken otter
dapper sky
#

<Client>.users.fetch(), returns a primise

broken otter
broken otter
dapper sky
#

yeah dont ask ai

#

To send a file pass it in in files:[] when sending the message

broken otter
#

How can I get him to DM me?

dapper sky
#

ask him

#

or do you mean the bot?

#

Then fetch the user

broken otter
#

Bot

dapper sky
#

As they arent always cached

#

And its cache

#

Not cashe

#

But that should error

#

So that code either isnt running or you're ignoring your errors

broken otter
#

can you give an example? I don’t understand anything from your words, I’m writing in a different language altogether, I just needed discord.js😔

dapper sky
#

<Client>.users.fetch(id), returns a promise, call .send on the result

broken otter
broken otter
# dapper sky <Client>.users.fetch(id), returns a promise, call .send on the result

like this?

$djsEval[(async () => {
  const discordTranscripts = require("discord-html-transcripts");
  const channel = client.channels.cache.get("$channelID");
  const attachment = await discordTranscripts.createTranscript(channel, {
      filename: "transcript.html",
      saveImages: true, 
      poweredBy: false,
      number: message.content 
  });
client.users.fetch(602842619797569587);
 call.send({
    files: [attachment]
  });
})();false]```
dapper sky
#

no

#

That returns a promise

#

You never define call either

#

Nor do anything with the fetch result

#

This is basic js at this point

#

That channel getting is also invalid

#

I suggest you learn js first, #rules 3 #resources

broken otter
dapper sky
#

No

#

Thats basic js

#

And invalid syntax

#

Not to mention that snowflakes are strings

broken otter
# dapper sky Not to mention that snowflakes are strings

I changed the code a little, can you tell me what's wrong here?

$djsEval[(async () => {
  const discordTranscripts = require("discord-html-transcripts");
  const userId = '602842619797569587';
  const user = client.users.cashe.get(userId);
  const channel = message.channel.id;
  const attachment = await discordTranscripts.createTranscript(channel, {
      filename: "transcript.html",
      saveImages: true, 
      poweredBy: false,
      number: message.content 
  });
 user.send({
    files: [attachment]
  });
})();false]```
dapper sky
#

you arent fetching

#

a'd again even then

#

Cache is spelled wrong

broken otter
# dapper sky Cache is spelled wrong

which is correct? bro, I understand that I’ve already pissed you off, but because of the very crooked Google translator, I can’t understand what you meant

broken otter
dusky hearth
#
-cashe
+cache

...cache.get() just accesses local data
<Client>.users.cache won't necessarily contain the given User
therefore, it's better to use <Client>.users.fetch() in order to query the API if your local data doesn't have the user

broken otter
broken otter
#
$djsEval[(async () => {
  const discordTranscripts = require("discord-html-transcripts");
  const userId = '602842619797569587';
  const user = client.users.fetch(userId);
  const channel = message.channel.id;
  const attachment = await discordTranscripts.createTranscript(channel, {
      filename: "transcript.html",
      saveImages: true, 
      poweredBy: false,
      number: message.content 
  });
 user.send({
    files: [attachment]
  });
})();false]```
dusky hearth
#

given that you aren't calling <Channel>.isTextBased() anywhere, I'd assume this is more an issue with one of the third-party libraries you're using, such as aoi.js or discord-html-transcripts
we will not be able to provide support for these
there was a known internal issue that was previously fixed that featured this error, but it was related to how interactions are handled
you don't appear to be using interactions anywhere in this code