aboutsummaryrefslogtreecommitdiff
path: root/174bg
diff options
context:
space:
mode:
Diffstat (limited to '174bg')
-rw-r--r--174bg/discord-bot/main.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/174bg/discord-bot/main.js b/174bg/discord-bot/main.js
index 4469f48..bba5413 100644
--- a/174bg/discord-bot/main.js
+++ b/174bg/discord-bot/main.js
@@ -109,7 +109,12 @@ const commands = [
);
// notify all members with the quartermaster role
+ // fetch guild members so the cache (and role.members) reflects the latest state
+ await interaction.guild.members.fetch();
const quartermasterMembers = quartermasterRole.members;
+ console.log(
+ `Notifying ${quartermasterMembers.size} quartermaster members...`,
+ );
for (const member of quartermasterMembers.values()) {
await member.send(
`A new requisition ticket has been created: <#${newChannel.id}>`,
@@ -149,7 +154,9 @@ const commands = [
},
];
-const client = new Client({ intents: [GatewayIntentBits.Guilds] });
+const client = new Client({
+ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers],
+});
client.on(Events.ClientReady, async (readyClient) => {
console.log(`Logged in as ${readyClient.user.tag}!`);