The bot is silent and does not send me a transcript

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]
$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]
24 Replies
d.js toolkit
d.js toolkit13mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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!
treble/luna
treble/luna13mo ago
Not all users are cached, fetch instead, and cath the rejection
chernogolovka🐦
chernogolovka🐦OP13mo ago
How is that? Could you show it? I'm generally 0 in discord.js, I've already suffered with this skin for 10 years
treble/luna
treble/luna13mo ago
<Client>.users.fetch(), returns a primise
chernogolovka🐦
chernogolovka🐦OP13mo ago
if anything, at the very bottom is the code for sending the file to me in private messages, I asked the AI to generate it so that the TF would have an idea of what it is How can I make the bot send me the transcript it creates via PM?
treble/luna
treble/luna13mo ago
yeah dont ask ai To send a file pass it in in files:[] when sending the message
chernogolovka🐦
chernogolovka🐦OP13mo ago
yes that's understandable How can I get him to DM me?
treble/luna
treble/luna13mo ago
ask him or do you mean the bot? Then fetch the user
chernogolovka🐦
chernogolovka🐦OP13mo ago
Bot
treble/luna
treble/luna13mo ago
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
chernogolovka🐦
chernogolovka🐦OP13mo ago
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😔
treble/luna
treble/luna13mo ago
<Client>.users.fetch(id), returns a promise, call .send on the result
chernogolovka🐦
chernogolovka🐦OP13mo ago
Additionally, I don’t know English well and use a translator😬 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]
$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]
treble/luna
treble/luna13mo ago
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
chernogolovka🐦
chernogolovka🐦OP13mo ago
this is different, this is already aoi.js
treble/luna
treble/luna13mo ago
No Thats basic js And invalid syntax Not to mention that snowflakes are strings
chernogolovka🐦
chernogolovka🐦OP13mo ago
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]
$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]
treble/luna
treble/luna13mo ago
you arent fetching a'd again even then Cache is spelled wrong
chernogolovka🐦
chernogolovka🐦OP13mo ago
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 Google translator actually translated this message as “you’re not attractive”
duck
duck13mo ago
-cashe
+cache
-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
chernogolovka🐦
chernogolovka🐦OP13mo ago
Got it, thanks, I'll check it right now
chernogolovka🐦
chernogolovka🐦OP13mo ago
I'll post the code right now
No description
chernogolovka🐦
chernogolovka🐦OP13mo ago
$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]
$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]
duck
duck13mo ago
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 regardless of whether you decide to attempt to fix this on your own or ask for support elsewhere, you will likely want to properly log your errors so that you can see the error's stack trace
Want results from more Discord servers?
Add your server