Spaces:
Runtime error
Runtime error
remove: unused code
Browse files
app.py
CHANGED
|
@@ -4,24 +4,12 @@ import re
|
|
| 4 |
from slack_sdk import WebClient
|
| 5 |
from slack_sdk.errors import SlackApiError
|
| 6 |
|
| 7 |
-
def extract_thread_ts_from_permalink(permalink):
|
| 8 |
-
# permalink์์ thread_ts๋ฅผ ์ถ์ถํ๋ ์ ๊ท ํํ์
|
| 9 |
-
match = re.search("\/archives\/(.+)\/p(\d+)", permalink)
|
| 10 |
-
|
| 11 |
-
if match:
|
| 12 |
-
thread_ts = match.group(2)
|
| 13 |
-
# thread_ts๋ ์์์ ํํ์ด๋ฏ๋ก, ์ ์ ๋ถ๋ถ๋ง ๊ฐ์ ธ์จ ํ ์์์ ์ ์ถ๊ฐํฉ๋๋ค.
|
| 14 |
-
thread_ts = f"{thread_ts[:-6]}.{thread_ts[-6:]}"
|
| 15 |
-
return thread_ts
|
| 16 |
-
else:
|
| 17 |
-
return None
|
| 18 |
-
|
| 19 |
|
| 20 |
def fetch_text_from_slack_thread(bot_token, thread_link):
|
| 21 |
try:
|
| 22 |
client = WebClient(token=bot_token)
|
| 23 |
# ์ฐ๋ ๋ ๋งํฌ์์ ์ฑ๋ ID์ ๋ฉ์์ง์ ํ์์คํฌํ๋ฅผ ์ถ์ถ
|
| 24 |
-
channel_id, message_ts = re.search("\/archives\/(.+)\/p(
|
| 25 |
thread_ts = f"{message_ts[:-6]}.{message_ts[-6:]}"
|
| 26 |
|
| 27 |
# ์ฌ๋ API๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๋ ๋์ ๋ชจ๋ ๋ฉ์์ง ๊ฐ์ ธ์ค๊ธฐ
|
|
|
|
| 4 |
from slack_sdk import WebClient
|
| 5 |
from slack_sdk.errors import SlackApiError
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def fetch_text_from_slack_thread(bot_token, thread_link):
|
| 9 |
try:
|
| 10 |
client = WebClient(token=bot_token)
|
| 11 |
# ์ฐ๋ ๋ ๋งํฌ์์ ์ฑ๋ ID์ ๋ฉ์์ง์ ํ์์คํฌํ๋ฅผ ์ถ์ถ
|
| 12 |
+
channel_id, message_ts = re.search("\/archives\/(.+)\/p(\d+)", thread_link).groups()
|
| 13 |
thread_ts = f"{message_ts[:-6]}.{message_ts[-6:]}"
|
| 14 |
|
| 15 |
# ์ฌ๋ API๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๋ ๋์ ๋ชจ๋ ๋ฉ์์ง ๊ฐ์ ธ์ค๊ธฐ
|