Compare commits
3 Commits
feature/do
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cae3e60f4 | |||
| d72247b5f9 | |||
| 42fc11b2a3 |
9
SETUP.md
9
SETUP.md
@@ -129,11 +129,12 @@ The app-level token (`xapp-...`) is what Socket Mode uses to open a WebSocket co
|
|||||||
|
|
||||||
## Step 3 — Get the Bot User OAuth Token
|
## Step 3 — Get the Bot User OAuth Token
|
||||||
|
|
||||||
If you haven't copied it already:
|
|
||||||
|
|
||||||
1. In the left sidebar, click **OAuth & Permissions**
|
1. In the left sidebar, click **OAuth & Permissions**
|
||||||
2. At the top of the page, find **Bot User OAuth Token**
|
2. Scroll to the **OAuth Tokens** section — if you see a **Bot User OAuth Token** starting with `xoxb-`, copy it and skip ahead to Step 4
|
||||||
3. Copy it — it starts with `xoxb-`
|
3. If no token is shown, click **Install to Workspace** (you may see this button at the top of the page or in the **Install App** sidebar section)
|
||||||
|
4. Review the permissions and click **Allow**
|
||||||
|
5. After the confirmation step, you'll be redirected back — your **Bot User OAuth Token** (`xoxb-…`) will now appear under **OAuth Tokens**
|
||||||
|
6. Copy it
|
||||||
|
|
||||||
> **If you change scopes later**, you must reinstall the app for the token to pick up the new permissions. Go to **Install App** → **Reinstall to Workspace**.
|
> **If you change scopes later**, you must reinstall the app for the token to pick up the new permissions. Go to **Install App** → **Reinstall to Workspace**.
|
||||||
|
|
||||||
|
|||||||
2
bot.py
2
bot.py
@@ -5,6 +5,7 @@ import time
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from md2mrkdwn import convert as md_to_slack
|
||||||
from slack_bolt import App
|
from slack_bolt import App
|
||||||
from slack_bolt.adapter.socket_mode import SocketModeHandler
|
from slack_bolt.adapter.socket_mode import SocketModeHandler
|
||||||
|
|
||||||
@@ -105,6 +106,7 @@ def handle_mention(event, client, say):
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = response.json()
|
data = response.json()
|
||||||
reply_text = data["choices"][0]["message"]["content"]
|
reply_text = data["choices"][0]["message"]["content"]
|
||||||
|
reply_text = md_to_slack(reply_text)
|
||||||
|
|
||||||
# Post the reply
|
# Post the reply
|
||||||
if len(reply_text) <= MAX_INLINE_LENGTH:
|
if len(reply_text) <= MAX_INLINE_LENGTH:
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
slack-bolt==1.28.0
|
slack-bolt==1.28.0
|
||||||
requests==2.33.1
|
requests==2.33.1
|
||||||
|
md2mrkdwn==0.4.3
|
||||||
|
|||||||
Reference in New Issue
Block a user