Skip to content

Commit

Permalink
Merge pull request #5 from after-ephemera/jkj/slack-platform
Browse files Browse the repository at this point in the history
slack bolt rewrite
  • Loading branch information
after-ephemera authored Feb 2, 2024
2 parents 6857f67 + c8bf071 commit fba7212
Show file tree
Hide file tree
Showing 39 changed files with 4,928 additions and 1,372 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
40 changes: 40 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: "standard-with-typescript",
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/quotes": ["warn", "double"],
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/member-delimiter-style": [
"error",
{
multiline: {
delimiter: "semi",
},
singleline: {
delimiter: "semi",
},
},
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/space-before-function-paren": "off",
},
};
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
labels:
- "npm"
- "dependencies"
groups:
linter:
patterns:
- "eslint*"
- "@typescript-eslint*"
20 changes: 0 additions & 20 deletions .github/workflows/create-github-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,9 @@ on:
workflow_dispatch:

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
with:
ref: master
- name: setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: install deps
run: bun i
- name: install config
run: echo '${{ secrets.DEFAULT_CONFIG }}' > config/default.json
- name: run tests
run: |
bun test
create-gh-release:
name: Create github release
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Linting with ESLint

on:
push:
branches: [ main ]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install modules
run: npm install
- name: Run ESLint
run: npm run lint
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
.DS_Store
.env*
dist
config/default.json
.idea
node_modules/
.env
dist/
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
FROM oven/bun:latest

FROM node:21 as builder
WORKDIR /slackbot
COPY package.json ./
COPY bun.lockb ./
COPY src/ ./src/
COPY tsconfig.json ./
COPY package-lock.json ./
COPY src/ ./src/
RUN npm install && npm run build

FROM node:21-slim
WORKDIR /slackbot
COPY package.json ./
COPY dist/ ./dist/
COPY --from=builder /slackbot/node_modules/ node_modules/
COPY config/ ./config/
CMD ["node", "dist/src/app.js"]

RUN bun install
CMD ["bun", "start"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Slack Technologies, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file modified bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion config/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"emoji": ":pagerduty:",
"emoji_conversation": ":pager: :poop:",
"welcome_message": "OnCall Bot is alive. TAG - you're it!",
"slack_token": "",
"bot_name": "OnCall Bot",
"cache_interval_seconds": 3600,
"next_in_queue_interval": 60,
Expand Down
5 changes: 5 additions & 0 deletions env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SLACK_CLIENT_ID=YOUR_SLACK_CLIENT_ID
SLACK_CLIENT_SECRET=YOUR_SLACK_CLIENT_SECRET
SLACK_SIGNING_SECRET=YOUR_SLACK_SIGNING_SECRET
SLACK_APP_TOKEN=YOUR_SLACK_APP_TOKEN
SLACK_BOT_TOKEN=YOUR_SLACK_BOT_TOKEN
59 changes: 59 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"_metadata": {
"major_version": 1,
"minor_version": 1
},
"display_information": {
"name": "Bolt Template App"
},
"features": {
"app_home": {
"home_tab_enabled": true,
"messages_tab_enabled": false,
"messages_tab_read_only_enabled": true
},
"bot_user": {
"display_name": "Bolt Template App",
"always_online": false
},
"shortcuts": [
{
"name": "Run sample shortcut",
"type": "global",
"callback_id": "sample_shortcut_id",
"description": "Runs a sample shortcut"
}
],
"slash_commands": [
{
"command": "/sample-command",
"description": "Runs a sample command",
"should_escape": false
}
]
},
"oauth_config": {
"scopes": {
"bot": [
"channels:history",
"chat:write",
"commands"
]
}
},
"settings": {
"event_subscriptions": {
"bot_events": [
"app_home_opened",
"message.channels",
"app_mention"
]
},
"interactivity": {
"is_enabled": true
},
"org_deploy_enabled": false,
"socket_mode_enabled": true,
"token_rotation_enabled": false
}
}
Loading

0 comments on commit fba7212

Please sign in to comment.