Skip to content

Commit

Permalink
Merge pull request #41 from Epse/add_roles_to_events
Browse files Browse the repository at this point in the history
Add option to mention roles on event create
  • Loading branch information
Epse authored Nov 16, 2024
2 parents b2c20c9 + 2c9b9bc commit 22f1f19
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
}
},
"events": {
"announcement_channel_id": "1253343601367322664"
"announcement_channel_id": "1253343601367322664",
"add_roles": []
},
"backup_request": {
"ignore_uids": [
Expand Down
7 changes: 6 additions & 1 deletion src/commands/events/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default {
});
return;
}
await interaction.deferReply({ephemeral: true})

const startMessage = await channel.send({
embeds: [new EmbedBuilder()
Expand All @@ -58,8 +59,12 @@ export default {
if (interaction.member instanceof GuildMember) {
await thread.members.add(interaction.member)
}
for (const roleId of config.events.add_roles) {
const role = await interaction.guild.roles.fetch(roleId);
role.members.each(async member => await thread.members.add(member))
}

await interaction.reply({
await interaction.followUp({
ephemeral: true,
content: `Message posted: https://discord.com/channels/${startMessage.guildId}/${startMessage.channelId}/${startMessage.id}`
});
Expand Down
4 changes: 3 additions & 1 deletion src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export interface Config {
},
events: {
// Where to post events threads, not announcements
announcement_channel_id: string
announcement_channel_id: string,
// Role IDs to automatically add to event threads
add_roles: string[],
},
/*
Settings for auto-deletion of messages.
Expand Down

0 comments on commit 22f1f19

Please sign in to comment.