announcements #18
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/announce"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[WIP] announcementsto announcementscloses #17
@ -59,0 +60,4 @@await lastMessage.delete()const event = await getEvent(guild, guild.id, requestId)if(event) {updateEvent(event, votes, guild!, guildId, requestId)If
guildis already used and necessary in line 61, it should already be present and usable, so the non-null-assertion should not be needed.➕
@ -27,6 +28,8 @@ export async function execute(oldEvent: GuildScheduledEvent, newEvent: GuildScheif (newEvent.status === GuildScheduledEventStatus.Active)createJFUsers(members, newEvent.name, requestId)else {const announcements = (await client.getAnnouncementChannelForGuild(newEvent.guild!.id).messages.fetch()).filter(message => !message.pinned)check for presence of
newEvent.guildat the start of theexecutefunction.That way we can also log the absence if it occurs.
@ -120,0 +135,4 @@if (messages.size > 1) {logger.error("More than one pinned announcement Messages found. Unable to know which one people react to. Please fix!", { guildId: guild.id, requestId })} else if (messages.size == 0) {logger.error("Could not find any pinned announcement messages. Unable to manage roles!", { guildId: guild.id, requestId })Unable to continue, should result in a return.
@ -120,0 +138,4 @@logger.error("Could not find any pinned announcement messages. Unable to manage roles!", { guildId: guild.id, requestId })}const message = await messages.at(0)!.fetch()@ -120,0 +152,4 @@}}public stopAnnouncementRoleBackgroundTask(guild: string | Guild, requestId: string) {Would it be possible to just use string as type for
guildso we don't have to check multiple times if we have a guild object?