How to get a server on Shard 1, from Shard 2?

How do I get a server on Shard 1, from Shard 2? I need to get a server on a different shard sometimes, to check if the user who ran the command has a role on my bot's support server:
let donor = '\❌'
let member;
try {
member = await server.members.fetch(`${interaction.user.id}`)
} catch (error) {
member = undefined
}
if (
member !== undefined &&
member.roles.cache.has(config.premium_teaser_role) ||
member.roles.cache.has(config.premium_gold_role) ||
member.roles.cache.has(config.premium_diamond_role) ||
member.roles.cache.has(config.premium_ruby_role)
) {
donor = '\✅'
}
await server.members.fetch()
let donors = await server.roles.cache.get(config.patron_role).members.size
let donor = '\❌'
let member;
try {
member = await server.members.fetch(`${interaction.user.id}`)
} catch (error) {
member = undefined
}
if (
member !== undefined &&
member.roles.cache.has(config.premium_teaser_role) ||
member.roles.cache.has(config.premium_gold_role) ||
member.roles.cache.has(config.premium_diamond_role) ||
member.roles.cache.has(config.premium_ruby_role)
) {
donor = '\✅'
}
await server.members.fetch()
let donors = await server.roles.cache.get(config.patron_role).members.size
5 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Iced Queen
Iced QueenOP2y ago
Updated the message :) Wrong ping
d.js docs
d.js docs2y ago
guide Sharding: Sending messages across shards read more
Iced Queen
Iced QueenOP2y ago
I'm not sure I get the guide...
client.shard.broadcastEval(async (c, { guildId }) => {
const server = c.guilds.cache.get('992937347094155356')
if (server) {
let donor = '\❌'
let member;
try {
member = await server.members.fetch(`${interaction.user.id}`)
} catch (error) {
member = undefined
}
if (
member !== undefined &&
member.roles.cache.has(config.premium_teaser_role) ||
member.roles.cache.has(config.premium_gold_role) ||
member.roles.cache.has(config.premium_diamond_role) ||
member.roles.cache.has(config.premium_ruby_role)
) {
donor = '\✅'
}
await server.members.fetch()
let donors = await server.roles.cache.get(config.patron_role).members.size
return true;
}
return false;
}, { context: { guildId: id } })
client.shard.broadcastEval(async (c, { guildId }) => {
const server = c.guilds.cache.get('992937347094155356')
if (server) {
let donor = '\❌'
let member;
try {
member = await server.members.fetch(`${interaction.user.id}`)
} catch (error) {
member = undefined
}
if (
member !== undefined &&
member.roles.cache.has(config.premium_teaser_role) ||
member.roles.cache.has(config.premium_gold_role) ||
member.roles.cache.has(config.premium_diamond_role) ||
member.roles.cache.has(config.premium_ruby_role)
) {
donor = '\✅'
}
await server.members.fetch()
let donors = await server.roles.cache.get(config.patron_role).members.size
return true;
}
return false;
}, { context: { guildId: id } })
Does this look right or? I'm sorry, what do you mean?
let donor = '\❌'
let donors
client.shard.broadcastEval(async (c, { teaser, gold, diamond, ruby, patron }) => {
const server = c.guilds.cache.get('992937347094155356')
if (server) {
let member;
try {
member = await server.members.fetch(`${interaction.user.id}`)
} catch (error) {
member = undefined
}
if (
member !== undefined &&
member.roles.cache.has(teaser) ||
member.roles.cache.has(gold) ||
member.roles.cache.has(diamond) ||
member.roles.cache.has(ruby)
) {
donor = '\✅'
}
await server.members.fetch()
donors = await server.roles.cache.get(patron).members.size
return true;
}
return false;
}, {
context: {
teaser: config.premium_teaser_role,
gold: config.premium_gold_role,
diamond: config.premium_diamond_role,
ruby: config.premium_ruby_role,
patron: config.patron_role
}
})
let donor = '\❌'
let donors
client.shard.broadcastEval(async (c, { teaser, gold, diamond, ruby, patron }) => {
const server = c.guilds.cache.get('992937347094155356')
if (server) {
let member;
try {
member = await server.members.fetch(`${interaction.user.id}`)
} catch (error) {
member = undefined
}
if (
member !== undefined &&
member.roles.cache.has(teaser) ||
member.roles.cache.has(gold) ||
member.roles.cache.has(diamond) ||
member.roles.cache.has(ruby)
) {
donor = '\✅'
}
await server.members.fetch()
donors = await server.roles.cache.get(patron).members.size
return true;
}
return false;
}, {
context: {
teaser: config.premium_teaser_role,
gold: config.premium_gold_role,
diamond: config.premium_diamond_role,
ruby: config.premium_ruby_role,
patron: config.patron_role
}
})
Is this what you mean? So how do I return the check mark if the user has one of those roles and return the amount of members who has the "patron" role? Cause right now it returns the X when it shouldn't and undefined on the amount of "patron"s
Iced Queen
Iced QueenOP2y ago
{ name: 'Premium ' + config.patreon_emoji, value: `Active: \`${donor}\`\nPatrons: \`${donors}\``, inline: true },
{ name: 'Premium ' + config.patreon_emoji, value: `Active: \`${donor}\`\nPatrons: \`${donors}\``, inline: true },
Want results from more Discord servers?
Add your server