lunarflu HF staff commited on
Commit
4ba6ad1
·
verified ·
1 Parent(s): c6565e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -70,10 +70,12 @@ async def on_message(message):
70
  return
71
 
72
  # notification bot
 
73
  huggingfolks_role = discord.utils.get(message.guild.roles, id=897376942817419265)
74
  bots_role = discord.utils.get(message.guild.roles, id=1258328471609016341)
75
  #if huggingfolks_role not in message.author.roles: # no need for ping if we're already discussing
76
  if bots_role not in message.author.roles: # bots shouldn't trigger pings for this
 
77
  content = message.content.lower()
78
  for trigger, slack_mention in TRIGGERS.items():
79
  if all(word in content for word in trigger):
@@ -85,6 +87,7 @@ async def on_message(message):
85
  'mention': slack_mention,
86
  'trigger': trigger
87
  })
 
88
  break
89
 
90
  # Check if the message is in a thread
@@ -147,6 +150,7 @@ def post_to_slack_create_thread(channel, text, thread_ts=None):
147
  async def send_daily_pings():
148
  global daily_pings
149
  if daily_pings:
 
150
  # combine into one message
151
  combined_message = '\n'.join(f"{ping['author']} in #{ping['channel']} said: {ping['content']} (link: {ping['url']})" for ping in daily_pings)
152
  await post_to_slack(None, combined_message, SLACK_CHANNEL_ID_TEST, None, None, None)
 
70
  return
71
 
72
  # notification bot
73
+ print("on_message")
74
  huggingfolks_role = discord.utils.get(message.guild.roles, id=897376942817419265)
75
  bots_role = discord.utils.get(message.guild.roles, id=1258328471609016341)
76
  #if huggingfolks_role not in message.author.roles: # no need for ping if we're already discussing
77
  if bots_role not in message.author.roles: # bots shouldn't trigger pings for this
78
+ print(" not bot ")
79
  content = message.content.lower()
80
  for trigger, slack_mention in TRIGGERS.items():
81
  if all(word in content for word in trigger):
 
87
  'mention': slack_mention,
88
  'trigger': trigger
89
  })
90
+ print(f"daily pings:{daily_pings}")
91
  break
92
 
93
  # Check if the message is in a thread
 
150
  async def send_daily_pings():
151
  global daily_pings
152
  if daily_pings:
153
+ print("sending daily pings...")
154
  # combine into one message
155
  combined_message = '\n'.join(f"{ping['author']} in #{ping['channel']} said: {ping['content']} (link: {ping['url']})" for ping in daily_pings)
156
  await post_to_slack(None, combined_message, SLACK_CHANNEL_ID_TEST, None, None, None)