#MainGuild is not defined
1 messages ยท Page 1 of 1 (latest)
lmao
are you in the same function?
๐ shit
i put it in the end because i got told to console.log a variable outside the function before in this channel ๐
ong i hate this shit
"undefined"
client.on('ready', async () => {
const MainGuild = await client.guilds.cache.get("984989513757626368");
console.log(MainGuild)
MainGuild.commands.set(CommandsArray).then(async (command) => {
const Roles = (commandName) => {
const cmdPerms = CommandsArray.find((c) => c.name === commandName) + cmdPerms;
if(!cmdPerms) return null;
return MainGuild.roles.cache .filter((r) => r.permissions.has(cmdPerms));
}
const fullPermissions = command.reduce((accumulator, r) => {
const roles = Roles(r.names);
if(!roles) return accumulator;
const permissions = roles.reduce((a, r) => {
return [...a, {id: r.id, type: "ROLE", permission: true}]
}, []);
return [...accumulator, {id: r.id, permissions }]
}, []);
await MainGuild.commands.permissions.set({ fullPermissions });
});
});
}
just check if it is, ive done that too many times xd
nope its correct ๐
the fuck
i bet you its a spelling mistake somwhere else or a missing semicolon
did this work before?
colons dont matter in sj
js
i never use em
unless in a for loop
xd
yep, but i have have seen a lot of "undefined reading of property" errors
its the only one, is it worth going through the hastle
thats okay, ive never done the 32767 intents stuffymagic
always done it like this
make sure your intent thing includes flags.guilds
it hasnt worked for me before, when i followed the guide it didnt have enough since i jumped straight to audit logs and things
ill try that one. im not using much anyway
try it with the guide, that i can do more with than the bitfields (i can look into it if you want
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.GUILD_MEMBERS],
}),
})
if you try with this
yeah im not using messageEmbed in my index.js file ill just copy and paste that
add Intents to the const {client, collection thing
i had it before since as i said i followed the guide
then it should do it all for you
hmm
still same error and MainGuild giving undefined when i console.log()
latest version, but this was a new project and im pretty sure they made smaller version(s)
do you think theres any resources i could use for this?
console.log(client.guilds.cache)
sure ill try that
Collection(0) [Map] {}?? i have a Developer Folder in my commands and thats where my ping.js is but im pretty sure i have developer imported on there.
still same error btw
its not getting any guilds
are you logging your bot with the right token?
idk if you have multiple
Y e p
the bot console.log 'ed the ready event
it works for my testing bot :/
man i fr hate this shit ๐
ye but could be a bot thats not in any discord
i have more than a dozen bots
try regenerating
well i have to go now, ok sure
and replacing the old token
or
console.log(client.user.tag)
to check if its the right one
do that first
hhmm. ill try that
console.log(`Connected as ${client.user.tag}`)
holy god danm shit
i want to kill myself immediatly
well this conversation was absolutely useless
Xd
no its because i made a new bot and i didnt invite it to any server ๐
xd
sorry for wasting your time ๐ฟ
thats 10 minutes of our lives we arent getting back
oh i couldnt care less for my time, happy we got to the bottom of it
Have a wonderful day/night
xd
you too ๐ฟ (its night)
same for me, good night