lunarflu HF staff commited on
Commit
f0e4eac
1 Parent(s): 9e74838

go live, 6 hour ping for testing

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -74,23 +74,23 @@ async def on_message(message):
74
  print("on_message")
75
  huggingfolks_role = discord.utils.get(message.guild.roles, id=897376942817419265)
76
  bots_role = discord.utils.get(message.guild.roles, id=1258328471609016341)
77
- #if huggingfolks_role not in message.author.roles: # no need for ping if we're already discussing
78
- if bots_role not in message.author.roles: # bots shouldn't trigger pings for this
79
- print(" not bot ")
80
- content = message.content.lower()
81
-
82
- for trigger, slack_mention in TRIGGERS.items():
83
- if all(word in content for word in trigger):
84
- daily_pings.append({
85
- 'author': str(message.author),
86
- 'content': message.content,
87
- 'channel': message.channel.name,
88
- 'url': message.jump_url,
89
- 'mention': slack_mention,
90
- 'trigger': trigger
91
- })
92
- print(f"daily pings:{daily_pings}")
93
- break
94
 
95
  # Check if the message is in a thread
96
  if isinstance(message.channel, discord.Thread):
@@ -159,7 +159,7 @@ def send_daily_pings():
159
 
160
 
161
  response = slack_client.chat_postMessage(
162
- channel=SLACK_CHANNEL_ID_TEST,
163
  text=combined_message,
164
  unfurl_links=False,
165
  unfurl_media=False
@@ -182,7 +182,7 @@ async def post_to_slack(author, content, channel, url, slack_mention, trigger):
182
 
183
  executor = ThreadPoolExecutor(max_workers=1)
184
  scheduler = BackgroundScheduler(executors={'default': executor})
185
- scheduler.add_job(send_daily_pings, trigger='interval', seconds=10)
186
  scheduler.start()
187
 
188
 
 
74
  print("on_message")
75
  huggingfolks_role = discord.utils.get(message.guild.roles, id=897376942817419265)
76
  bots_role = discord.utils.get(message.guild.roles, id=1258328471609016341)
77
+ if huggingfolks_role not in message.author.roles: # no need for ping if we're already discussing
78
+ if bots_role not in message.author.roles: # bots shouldn't trigger pings for this
79
+ print(" not bot ")
80
+ content = message.content.lower()
81
+
82
+ for trigger, slack_mention in TRIGGERS.items():
83
+ if all(word in content for word in trigger):
84
+ daily_pings.append({
85
+ 'author': str(message.author),
86
+ 'content': message.content,
87
+ 'channel': message.channel.name,
88
+ 'url': message.jump_url,
89
+ 'mention': slack_mention,
90
+ 'trigger': trigger
91
+ })
92
+ print(f"daily pings:{daily_pings}")
93
+ break
94
 
95
  # Check if the message is in a thread
96
  if isinstance(message.channel, discord.Thread):
 
159
 
160
 
161
  response = slack_client.chat_postMessage(
162
+ channel=SLACK_CHANNEL_ID,
163
  text=combined_message,
164
  unfurl_links=False,
165
  unfurl_media=False
 
182
 
183
  executor = ThreadPoolExecutor(max_workers=1)
184
  scheduler = BackgroundScheduler(executors={'default': executor})
185
+ scheduler.add_job(send_daily_pings, trigger='interval', hours=6)
186
  scheduler.start()
187
 
188