Spaces:
Paused
Paused
solved tag test
Browse files
app.py
CHANGED
|
@@ -124,7 +124,7 @@ async def on_thread_create(thread):
|
|
| 124 |
if isinstance(thread.parent, discord.ForumChannel) and thread.parent.id in {ASK_FOR_HELP_CHANNEL_ID, GRADIO_CHANNEL_ID, ARGILLA_HELP_CHANNEL_ID, DATA_DISCUSSIONS_CHANNEL_ID}:
|
| 125 |
discord_thread_id = thread.id
|
| 126 |
slack_thread_ts = post_to_slack_create_thread(
|
| 127 |
-
|
| 128 |
f"New forum thread started in {thread.parent.name} by {thread.owner}: *{thread.name}*\n"
|
| 129 |
f"{thread.jump_url}"
|
| 130 |
)
|
|
@@ -172,6 +172,17 @@ async def list_tags(ctx, forum_channel_id: int):
|
|
| 172 |
tag_list = [f"{tag.name} (ID: {tag.id})" for tag in tags]
|
| 173 |
await ctx.send(f'Available tags: {", ".join(tag_list)}')
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
#----------------------------------------------------------------------------------------------
|
| 176 |
|
| 177 |
def send_daily_pings():
|
|
|
|
| 124 |
if isinstance(thread.parent, discord.ForumChannel) and thread.parent.id in {ASK_FOR_HELP_CHANNEL_ID, GRADIO_CHANNEL_ID, ARGILLA_HELP_CHANNEL_ID, DATA_DISCUSSIONS_CHANNEL_ID}:
|
| 125 |
discord_thread_id = thread.id
|
| 126 |
slack_thread_ts = post_to_slack_create_thread(
|
| 127 |
+
SLACK_CHANNEL_ID_TEST,
|
| 128 |
f"New forum thread started in {thread.parent.name} by {thread.owner}: *{thread.name}*\n"
|
| 129 |
f"{thread.jump_url}"
|
| 130 |
)
|
|
|
|
| 172 |
tag_list = [f"{tag.name} (ID: {tag.id})" for tag in tags]
|
| 173 |
await ctx.send(f'Available tags: {", ".join(tag_list)}')
|
| 174 |
|
| 175 |
+
|
| 176 |
+
# react with ✅ on slack if marked with solved tag on discord
|
| 177 |
+
@bot.event
|
| 178 |
+
async def on_thread_update(before, after):
|
| 179 |
+
if isinstance(after.parent, discord.ForumChannel) and after.parent.id in {ASK_FOR_HELP_CHANNEL_ID, GRADIO_CHANNEL_ID, ARGILLA_HELP_CHANNEL_ID, DATA_DISCUSSIONS_CHANNEL_ID}:
|
| 180 |
+
if 1026743978026094664 in [tag.id for tag in after.applied_tags]:
|
| 181 |
+
discord_thread_id = after.id
|
| 182 |
+
if discord_thread_id in thread_mapping:
|
| 183 |
+
slack_thread_ts = thread_mapping[discord_thread_id]
|
| 184 |
+
react_to_slack_message(slack_thread_ts, 'white_check_mark')
|
| 185 |
+
|
| 186 |
#----------------------------------------------------------------------------------------------
|
| 187 |
|
| 188 |
def send_daily_pings():
|