Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
added author names to thread replies
Browse files
app.py
CHANGED
@@ -92,17 +92,18 @@ async def on_thread_create(thread):
|
|
92 |
slack_thread_ts = post_to_slack_forum_version(
|
93 |
SLACK_CHANNEL_ID,
|
94 |
f"New forum thread started in #ask-for-help by {thread.owner}: *{thread.name}*\n"
|
95 |
-
f"{thread.jump_url}"
|
|
|
96 |
)
|
97 |
if slack_thread_ts:
|
98 |
thread_mapping[discord_thread_id] = slack_thread_ts
|
99 |
|
100 |
|
101 |
-
def post_to_slack_forum_version(channel, text, thread_ts=None):
|
102 |
try:
|
103 |
response = slack_client.chat_postMessage(
|
104 |
channel=channel,
|
105 |
-
text=text,
|
106 |
thread_ts=thread_ts
|
107 |
)
|
108 |
return response['ts'] # Return the Slack message timestamp (thread ID)
|
@@ -113,7 +114,6 @@ def post_to_slack_forum_version(channel, text, thread_ts=None):
|
|
113 |
|
114 |
|
115 |
|
116 |
-
|
117 |
async def post_to_slack(author, content, channel, url, slack_mention, trigger):
|
118 |
try:
|
119 |
response = slack_client.chat_postMessage(
|
|
|
92 |
slack_thread_ts = post_to_slack_forum_version(
|
93 |
SLACK_CHANNEL_ID,
|
94 |
f"New forum thread started in #ask-for-help by {thread.owner}: *{thread.name}*\n"
|
95 |
+
f"{thread.jump_url}",
|
96 |
+
thread.author
|
97 |
)
|
98 |
if slack_thread_ts:
|
99 |
thread_mapping[discord_thread_id] = slack_thread_ts
|
100 |
|
101 |
|
102 |
+
def post_to_slack_forum_version(channel, text, author, thread_ts=None):
|
103 |
try:
|
104 |
response = slack_client.chat_postMessage(
|
105 |
channel=channel,
|
106 |
+
text=author + ": " + text,
|
107 |
thread_ts=thread_ts
|
108 |
)
|
109 |
return response['ts'] # Return the Slack message timestamp (thread ID)
|
|
|
114 |
|
115 |
|
116 |
|
|
|
117 |
async def post_to_slack(author, content, channel, url, slack_mention, trigger):
|
118 |
try:
|
119 |
response = slack_client.chat_postMessage(
|