Skip to content

Commit

Permalink
Merge pull request #349 from ojaha065/develop
Browse files Browse the repository at this point in the history
1.8.0
  • Loading branch information
ojaha065 authored Oct 8, 2023
2 parents 3de829e + 145706f commit 231a927
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 164 deletions.
181 changes: 80 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lounasbotti",
"type": "module",
"version": "1.7.4",
"version": "1.8.0",
"private": true,
"description": "Slack bot for retrieving lunch menus of local restaurants. Very much WIP and not meant for public use.",
"main": "./dist/server.js",
Expand Down
2 changes: 1 addition & 1 deletion resources/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ features:
- command: /lounasbotti
url: https://lounasbotti-disec.fly.dev/slack/events
description: Manage Lounasbotti
usage_hint: "[ping | restart]"
usage_hint: "[ping | restart | [un]subscribe]"
should_escape: false
oauth_config:
scopes:
Expand Down
10 changes: 6 additions & 4 deletions src/BlockParsers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Job } from "node-schedule";
import { Bits, BlockCollection, Blocks, Elements, HomeTab, Md, setIfTruthy, user } from "slack-block-builder";
import { SlackBlockDto, SlackHomeTabDto } from "slack-block-builder/dist/internal";

Expand Down Expand Up @@ -43,13 +42,14 @@ export default class BlockParsers {
];
}

public static parseHomeTabView(data: { settings: Settings, version: string, userId: string, jobs: Record<string, Job> }): Readonly<SlackHomeTabDto> {
public static parseHomeTabView(data: { settings: Settings, version: string, userId: string}): Readonly<SlackHomeTabDto> {
const debugInformation: string[] = [
data.settings.configSource ? `Config loaded from ${data.settings.configSource}` : null,
`Data provider: ${(data.settings.dataProvider as LounasDataProvider).id} (${(data.settings.dataProvider as LounasDataProvider).baseUrl})`,
`[LounasEmoji] ${data.settings.emojiRules?.size ? `${data.settings.emojiRules?.size} regular expressions successfully loaded` : "No rules loaded"}`,
data.jobs.cacheClearing ? `Cached data will be cleared at ${data.jobs.cacheClearing.nextInvocation().toLocaleString("en-US")}` : null,
data.jobs.prefetch ? `Next data prefetching will occur at ${data.jobs.prefetch.nextInvocation().toLocaleString("en-US")}` : null
global.LOUNASBOTTI_JOBS.cacheClearing ? `Cached data will be cleared at ${global.LOUNASBOTTI_JOBS.cacheClearing.nextInvocation().toLocaleString("en-US")}` : null,
global.LOUNASBOTTI_JOBS.prefetch ? `Automatic posting to subscribed channels will next occur at ${global.LOUNASBOTTI_JOBS.prefetch.nextInvocation().toLocaleString("en-US")}` : null,
`${(data.settings.subscribedChannels || []).length} channel subscription(s)`
].filter(Boolean) as string[];

return HomeTab()
Expand All @@ -65,6 +65,8 @@ export default class BlockParsers {
Md.bold("Komennot") + "\n" +
[
["/lounas [<tyhjä> | tänään | huomenna]", "Aktivoi Lounasbotti ja hae lounaslistat"],
["/lounasbotti subscribe", "Aktivoi automaattinen tila kanavalle (Arkispäivisin klo. 10:30)"],
["/lounasbotti unsubscribe", "Poista automaattinen tila käytöstä"],
["/lounasbotti restart", "Käynnistä sovellus uudelleen"],
["/lounasbotti ping", "Pong!"]
].map(command => `${Md.codeInline(command[0])} - ${command[1]}`).join("\n")
Expand Down
Loading

0 comments on commit 231a927

Please sign in to comment.