Ropyle
Ropyle
DIAdiscord.js - Imagine an app
Created by Ropyle on 12/23/2023 in #djs-questions
Event, guildMemberRemove is emitted when someone got banned
I got it! Thanks for your answers!
4 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
Thanks all you guys and have a nice day!
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
Yes it is!
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
?
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
this way
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
myGuilds.members.fetch({ user: "UserID", force: true });
myGuilds.members.fetch({ user: "UserID", force: true });
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
Thonkang
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
completely undertood
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
Now I am thinking of one bulldozing idea: When processing finished process.exit(0); so that every time the command get called, my bot can get Tom/Himself's latest position.
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
Also, I found when the code gets restarted, He gets the latest one.
12 replies
DIAdiscord.js - Imagine an app
Created by Ropyle on 9/2/2023 in #djs-questions
Doesn't DiscordAPI reflect the latest role position?
Thanks for your answer, but the problem is still here. Current code:
//...
client.on('messageCreate', async message => {
if(message.content !== 'test') return;

const myGuild = await client.guilds.fetch('GuildID', true);
// "fetch" a guild
try { await myGuild.members.fetch(message.author.id, true) } catch (e){ return message.channel.send("Author is not a member of my guild."); };
// If message author is not a member of the guild
try { await myGuild.members.fetch('UserID', true) } catch(e) { return message.channel.send('UserID is not a member of my guild.'); };
// If the user is not a member of the guild
const authorMember = await myGuild.members.fetch(message.author.id, true),
// "fetch" message author
authorRank = await authorMember.roles.highest.position,
// Author's role position
targetMember = await myGuild.members.fetch('UserID', true),
// "fetch" the user
targetRank = await targetMember.roles.highest.position;
// The user's role position

console.log(`Author's role position: ${authorRank}\nThe Member's role position: ${targetRank}`);
})
//...
//...
client.on('messageCreate', async message => {
if(message.content !== 'test') return;

const myGuild = await client.guilds.fetch('GuildID', true);
// "fetch" a guild
try { await myGuild.members.fetch(message.author.id, true) } catch (e){ return message.channel.send("Author is not a member of my guild."); };
// If message author is not a member of the guild
try { await myGuild.members.fetch('UserID', true) } catch(e) { return message.channel.send('UserID is not a member of my guild.'); };
// If the user is not a member of the guild
const authorMember = await myGuild.members.fetch(message.author.id, true),
// "fetch" message author
authorRank = await authorMember.roles.highest.position,
// Author's role position
targetMember = await myGuild.members.fetch('UserID', true),
// "fetch" the user
targetRank = await targetMember.roles.highest.position;
// The user's role position

console.log(`Author's role position: ${authorRank}\nThe Member's role position: ${targetRank}`);
})
//...
12 replies