lunarflu HF staff commited on
Commit
b0918e1
1 Parent(s): b3ba3b3

adding some time.sleep(2) to stay within slack rate limits for posting messages

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import discord
2
  import threading
3
  import os
4
  import gradio as gr
 
5
  from discord.ext import commands
6
  from slack_sdk import WebClient
7
  from slack_sdk.errors import SlackApiError
@@ -257,6 +258,7 @@ def send_daily_pings():
257
  unfurl_links=False,
258
  unfurl_media=False
259
  )
 
260
  main_ts = main_message['ts']
261
  for ping in pings:
262
  slack_client.chat_postMessage(
@@ -266,6 +268,7 @@ def send_daily_pings():
266
  unfurl_links=False,
267
  unfurl_media=False
268
  )
 
269
 
270
  daily_pings = [] # reset after posting
271
 
 
2
  import threading
3
  import os
4
  import gradio as gr
5
+ import time
6
  from discord.ext import commands
7
  from slack_sdk import WebClient
8
  from slack_sdk.errors import SlackApiError
 
258
  unfurl_links=False,
259
  unfurl_media=False
260
  )
261
+ time.sleep(2) # https://api.slack.com/apis/rate-limits
262
  main_ts = main_message['ts']
263
  for ping in pings:
264
  slack_client.chat_postMessage(
 
268
  unfurl_links=False,
269
  unfurl_media=False
270
  )
271
+ time.sleep(2) # https://api.slack.com/apis/rate-limits
272
 
273
  daily_pings = [] # reset after posting
274