Skip to content

Commit 34811e5

Browse files
authored
Merge pull request #26 from fribyte-code/no-data-issue
Hopefully this works
2 parents 5c7047e + 087a87f commit 34811e5

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

src/actions.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ export async function sendDugnadAttendanceStats(client: Client4) {
9292
return tuple2[1] - tuple1[1];
9393
});
9494

95+
// Don't post if there's no attendance data
96+
if (attendanceEntries.length === 0) {
97+
console.info(
98+
new Date().toLocaleString(),
99+
`No attendance data to post in ${dugnadChannelName} channel`
100+
);
101+
return;
102+
}
103+
95104
await client.createPost({
96105
channel_id: dugnadChannel.id,
97106
message:

src/config.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@ const generalMessages: GeneralMessageConfig[] = [
2020
],
2121
reactions: ["white_check_mark", "x"],
2222
},
23-
{
24-
botMessageName: "social",
25-
get channelName() {
26-
return process.env.NODE_ENV === "production" ? "social" : "bot-test";
27-
},
28-
daysToMessage: [4], // Thursdays
29-
timeOfDayToMessage: 20, // 8pm
30-
messages: [
31-
"Hallisiken kedegis? Hypp på noe sosialt eller?? Reager med hva du ønsker\n// Helloski do something social or? React with what you want\n :video_game: :spiral_note_pad: :beers:",
32-
],
33-
reactions: ["video_game", "spiral_note_pad", "beers"],
34-
},
23+
// commented out due to spam
24+
// {
25+
// botMessageName: "social",
26+
// get channelName() {
27+
// return process.env.NODE_ENV === "production" ? "social" : "bot-test";
28+
// },
29+
// daysToMessage: [4], // Thursdays
30+
// timeOfDayToMessage: 20, // 8pm
31+
// messages: [
32+
// "Hallisiken kedegis? Hypp på noe sosialt eller?? Reager med hva du ønsker\n// Helloski do something social or? React with what you want\n :video_game: :spiral_note_pad: :beers:",
33+
// ],
34+
// reactions: ["video_game", "spiral_note_pad", "beers"],
35+
// },
36+
3537
// DrunkBot go home you have asked to many times now without any response
3638
// {
3739
// botMessageName: "drunkBot",

0 commit comments

Comments
 (0)