announcements #18

Merged
kenobi merged 13 commits from feat/announce into master 2023-06-15 22:05:20 +02:00
Collaborator
No description provided.
magnetotail added 1 commit 2023-06-12 22:22:01 +02:00
magnetotail added 1 commit 2023-06-12 22:34:55 +02:00
magnetotail added 2 commits 2023-06-13 18:59:03 +02:00
magnetotail added 1 commit 2023-06-13 20:13:22 +02:00
the message needed to be fetched again. Probably something with caches..
magnetotail added 2 commits 2023-06-13 23:15:10 +02:00
magnetotail requested review from kenobi 2023-06-13 23:15:19 +02:00
magnetotail changed title from [WIP] announcements to announcements 2023-06-13 23:15:23 +02:00
Author
Collaborator

closes #17

closes #17
magnetotail added 1 commit 2023-06-14 19:45:43 +02:00
We already have the role id?!?!?
magnetotail added 1 commit 2023-06-14 22:24:44 +02:00
All announcements but initial will be deleted upon event end.
Vote announcement will be deleted upon vote end
Vote and vote end announcement now contain date and time
kenobi requested changes 2023-06-15 20:39:27 +02:00
@ -59,0 +60,4 @@
await lastMessage.delete()
const event = await getEvent(guild, guild.id, requestId)
if(event) {
updateEvent(event, votes, guild!, guildId, requestId)
Owner

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.

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.
Author
Collaborator

kenobi marked this conversation as resolved
@ -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)
Owner

check for presence of newEvent.guild at the start of the execute function.
That way we can also log the absence if it occurs.

check for presence of `newEvent.guild` at the start of the `execute` function. That way we can also log the absence if it occurs.
kenobi marked this conversation as resolved
@ -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 })
Owner

Unable to continue, should result in a return.

Unable to continue, should result in a return.
kenobi marked this conversation as resolved
@ -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()
Owner
const message = await messages.at(0)?.fetch()
if (!message) {
  logger.error(`No pinned message found`,{requestId,guildId})
  return
}
``` const message = await messages.at(0)?.fetch() if (!message) { logger.error(`No pinned message found`,{requestId,guildId}) return } ```
kenobi marked this conversation as resolved
@ -120,0 +152,4 @@
}
}
public stopAnnouncementRoleBackgroundTask(guild: string | Guild, requestId: string) {
Owner

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?

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?
kenobi marked this conversation as resolved
magnetotail added 1 commit 2023-06-15 21:56:20 +02:00
kenobi added 1 commit 2023-06-15 21:59:28 +02:00
Merge branch 'master' into feat/announce
Some checks failed
Build a docker image for node-jellyfin-role-bot / build-docker-image (push) Failing after 1m1s
68662e72ad
magnetotail added 2 commits 2023-06-15 22:02:51 +02:00
Merge branch 'feat/announce' of ssh://gitea.brudi.xyz:222/kenobi/jellyfin-discord-bot into feat/announce
All checks were successful
Build a docker image for node-jellyfin-role-bot / build-docker-image (push) Successful in 1m26s
1ccb1a7cae
kenobi merged commit 8caf80f54e into master 2023-06-15 22:05:20 +02:00
kenobi deleted branch feat/announce 2023-06-15 22:05:21 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kenobi/jellyfin-discord-bot#18
No description provided.