announcements #18
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: kenobi/jellyfin-discord-bot#18
Loading…
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
guild
is 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: GuildSche
if (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.guild
at the start of theexecute
function.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
guild
so we don't have to check multiple times if we have a guild object?