why? " the bot have admin strator "

No description
52 Replies
d.js toolkit
d.js toolkit4w ago
FRD'
FRD'OP4w ago
the problem not from the code i guess but please reply quickly if any one came mention please
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
اوك okay
FRD'
FRD'OP4w ago
const { Events } = require('discord.js'); module.exports = { name: Events.MessageCreate, async execute(message) { if (message.author.bot) return; const TARGET_CHANNEL_IDS = ['1397239374697201757', '1399312419909795943']; // الرومات اللي تبيها const LINE_IMAGE_URL = 'https://i.postimg.cc/PJRPKVkF/image.jpg'; if (TARGET_CHANNEL_IDS.includes(message.channel.id)) { try { await message.react('🤍'); await message.channel.send({ files: [LINE_IMAGE_URL] }); } catch (error) { console.error('خطأ في ردة الفعل أو إرسال الصورة:', error); } } }, };
FRD'
FRD'OP4w ago
@rmHawk765©®™
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
i didnt understand
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
ok in athkar.js ? bc there is 15+ files
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
ok 1min
FRD'
FRD'OP4w ago
No description
FRD'
FRD'OP4w ago
@rmHawk765©®™
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
oh , ok
b3ssel
b3ssel4w ago
message is very likely to not be an actual Message
FRD'
FRD'OP4w ago
No description
b3ssel
b3ssel4w ago
show your index.js or wherever your event handler is present
FRD'
FRD'OP4w ago
const { Events } = require('discord.js'); module.exports = { name: Events.MessageCreate, async execute(message) { // ✅ طباعة معلومات المرسل قبل أي شرط console.log('From', message.author); // ✅ تأكد إن message.author موجود ثم تحقق من إذا كان بوت if (!message.author || message.author.bot) return; const TARGET_CHANNEL_IDS = ['1397239374697201757', '1399312419909795943']; const LINE_IMAGE_URL = 'https://i.postimg.cc/PJRPKVkF/image.jpg'; if (TARGET_CHANNEL_IDS.includes(message.channel.id)) { try { await message.react('🤍'); await message.channel.send({ files: [LINE_IMAGE_URL] }); } catch (error) { console.error('❌ Error Sending The Photo:', error); } } }, };
FRD'
FRD'OP4w ago
thats athkar.js
b3ssel
b3ssel4w ago
that's not what I asked
b3ssel
b3ssel4w ago
and please use https://srcb.in/ for sharing code
SourceBin
SourceBin | Sharing code made easy
Instantly share your code with the world.
FRD'
FRD'OP4w ago
ok ok how do i share from that? i just put it and do copy and send?
b3ssel
b3ssel4w ago
yes no wait press on “save” at the bottom right
FRD'
FRD'OP4w ago
what i press
b3ssel
b3ssel4w ago
okay now you should be able to paste the link
FRD'
FRD'OP4w ago
i take out the token?
FRD'
FRD'OP4w ago
SourceBin
Index
Instantly share your code with the world.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
dn .
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
b3ssel
b3ssel4w ago
lines 56 and 58: at the end you have (client, …args) but the event files use async execute(message) << this one for your message create events so now client in your index.js is called message in your event files so to fix it you should add client as first parameter everywhere in your event files async execute(client, message) as example for your message create event files
FRD'
FRD'OP4w ago
that will solve the problem<
b3ssel
b3ssel4w ago
yeah that should solve the problem
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
the event files only yes?
b3ssel
b3ssel4w ago
yes but when for instance your event file is using name: Events.MessageUpdate then you would get async execute(client, oldMessage, newMessage)
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
No description
b3ssel
b3ssel4w ago
yeah so it works you logged the client user
FRD'
FRD'OP4w ago
but the commands not working look at the console
No description
b3ssel
b3ssel4w ago
thats not an error that is console.log(message.author) which you added yourself
FRD'
FRD'OP4w ago
i know but why the commands not working
b3ssel
b3ssel4w ago
idk the question was “how to get rid of this error?”
FRD'
FRD'OP4w ago
is it from the host?
b3ssel
b3ssel4w ago
no it was a javascript error
FRD'
FRD'OP4w ago
how ill solve it
b3ssel
b3ssel4w ago
I don’t see any error in your console now so there’s nothing to solve for me now
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
FRD'
FRD'OP4w ago
What info u need @rmHawk765©®™ @b3ssel .
d.js docs
d.js docs3w ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. - Once you do, log relevant values and if-conditions - More sophisticated debugging methods are breakpoints and runtime inspections: learn more

Did you find this page helpful?