Skip to content

Commit

Permalink
Merge pull request #352 from ojaha065/develop
Browse files Browse the repository at this point in the history
1.8.1
  • Loading branch information
ojaha065 authored Oct 14, 2023
2 parents 231a927 + fb53ea0 commit dbd7df7
Show file tree
Hide file tree
Showing 20 changed files with 223 additions and 139 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"plugin:import/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript"
"plugin:import/typescript",
"alloy",
"alloy/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down
165 changes: 110 additions & 55 deletions package-lock.json

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

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lounasbotti",
"type": "module",
"version": "1.8.0",
"version": "1.8.1",
"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 All @@ -17,7 +17,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"lint": "eslint . --no-fix --max-warnings 0 --rule \"linebreak-style:off\"",
"sentry:sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist"
"sentry:sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload --release=%npm_package_version% ./dist"
},
"keywords": [
"bot",
Expand All @@ -41,14 +41,15 @@
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"eslint": "^8.45.0",
"eslint-config-alloy": "^5.1.2",
"eslint-import-resolver-typescript": "^3.3.0",
"eslint-plugin-import": "^2.27.5",
"ts-node": "^10.9.1",
"typescript": "^5.0.2"
},
"dependencies": {
"@sentry/integrations": "^7.72.0",
"@sentry/node": "^7.72.0",
"@sentry/integrations": "^7.74.0",
"@sentry/node": "^7.74.0",
"@slack/bolt": "^3.13.0",
"cheerio": "^1.0.0-rc.10",
"dotenv": "^16.3.1",
Expand Down
4 changes: 3 additions & 1 deletion resources/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ oauth_config:
scopes:
bot:
- channels:history
- channels:join
- chat:write
- chat:write.public
- commands
- im:history
- reactions:write
- chat:write.public
- channels:manage
settings:
event_subscriptions:
request_url: https://lounasbotti-disec.fly.dev/slack/events
Expand Down
4 changes: 2 additions & 2 deletions src/AdminEvents.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bolt from "@slack/bolt";
import { Settings } from "./model/Settings.js";
import type bolt from "@slack/bolt";
import type { Settings } from "./model/Settings.js";

const ANNOUNCE_REGEXP = /lounasbotti\sadmin\sannounce\s"((?:\w|\d){1,30})"\s"([^"]{1,2000})"/;

Expand Down
15 changes: 8 additions & 7 deletions src/BlockParsers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Bits, BlockCollection, Blocks, Elements, HomeTab, Md, setIfTruthy, user } from "slack-block-builder";
import { SlackBlockDto, SlackHomeTabDto } from "slack-block-builder/dist/internal";
import type { SlackBlockDto, SlackHomeTabDto } from "slack-block-builder/dist/internal";

import { LounasDataProvider, LounasResponse } from "./model/dataProviders/LounasDataProvider.js";
import { RestaurantNameMap, Settings } from "./model/Settings.js";
import type { LounasResponse } from "./model/dataProviders/LounasDataProvider.js";
import type { Settings } from "./model/Settings.js";
import { RestaurantNameMap } from "./model/Settings.js";

export default class BlockParsers {
private static limitVotesToOneOptionBit = Bits.Option({ text: "Salli käyttäjän äänestää vain yhtä vaihtoehtoa" });
Expand Down Expand Up @@ -42,19 +43,19 @@ export default class BlockParsers {
];
}

public static parseHomeTabView(data: { settings: Settings, version: string, userId: string}): Readonly<SlackHomeTabDto> {
public static parseHomeTabView(data: { settings: Settings, 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})`,
`Data provider: ${data.settings.dataProvider.id} (${data.settings.dataProvider.baseUrl})`,
`[LounasEmoji] ${data.settings.emojiRules?.size ? `${data.settings.emojiRules?.size} regular expressions successfully loaded` : "No rules loaded"}`,
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,
global.LOUNASBOTTI_JOBS.subscriptions ? `Automatic posting to subscribed channels will next occur at ${global.LOUNASBOTTI_JOBS.subscriptions.nextInvocation().toLocaleString("en-US")}` : null,
`${(data.settings.subscribedChannels || []).length} channel subscription(s)`
].filter(Boolean) as string[];

return HomeTab()
.blocks(
Blocks.Header({ text: `Lounasbotti V${data.version}` }).end(),
Blocks.Header({ text: `Lounasbotti ${global.LOUNASBOTTI_VERSION}` }).end(),
Blocks.Section({ text: Md.italic("By <https://github.com/ojaha065|Jani Haiko>") }).end(),
Blocks.Divider().end(),

Expand Down
Loading

0 comments on commit dbd7df7

Please sign in to comment.