Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
update to ping multiple people if they subscribe to same keyword
Browse files
app.py
CHANGED
|
@@ -28,39 +28,29 @@ GRADIO_CHANNEL_ID = 1025174734427656283
|
|
| 28 |
ARGILLA_HELP_CHANNEL_ID = 1253640751481356330
|
| 29 |
DATA_DISCUSSIONS_CHANNEL_ID = 1217179426002047076
|
| 30 |
|
| 31 |
-
|
| 32 |
TRIGGERS = {
|
| 33 |
-
("discord bot",): "<@U051DB2754M>",
|
| 34 |
-
("autotrain",): "<@U01E3LEC2N7>",
|
| 35 |
-
("auto train",): "<@U01E3LEC2N7>", # abhishek
|
| 36 |
-
("competition",): "<@U01E3LEC2N7>", # abhishek
|
| 37 |
-
("competitions",): "<@U01E3LEC2N7>", # abhishek
|
| 38 |
-
("text to speech",): "<@U039C2GANMV>",
|
| 39 |
-
("tts",): "<@U039C2GANMV>", # VB
|
| 40 |
-
("asr",): "<@U039C2GANMV>", # VB
|
| 41 |
-
("musicgen",): "<@U039C2GANMV>", # VB
|
| 42 |
-
("whisper",): "<@U039C2GANMV>", # VB
|
| 43 |
-
("speech recognition",): "<@U039C2GANMV>", # VB
|
| 44 |
-
("bark",): "<@U039C2GANMV>", # VB
|
| 45 |
-
("sentence-transformers",): "<@U04E4DNPWG7>",
|
| 46 |
-
("sentence_transformers",): "<@U04E4DNPWG7>", # tom aarsen
|
| 47 |
-
("setfit",): "<@U04E4DNPWG7>", # tom aarsen
|
| 48 |
-
("sentence transformers",): "<@U04E4DNPWG7>", # tom aarsen
|
| 49 |
-
("argilla",): "<@U076B8C7G3E>", # david berenstein
|
| 50 |
-
("distilabel",): "<@U076B8C7G3E>", # david berenstein
|
| 51 |
-
("
|
| 52 |
-
("
|
| 53 |
-
("
|
| 54 |
-
("
|
| 55 |
-
("gradio",): "<@U04FLGQ26PQ>", # yuvraj sharma
|
| 56 |
-
("argilla",): "<@U076MF65WEM>", # sara han diaz lorenzo
|
| 57 |
-
("distilabel",): "<@U076MF65WEM>", # sara han diaz lorenzo
|
| 58 |
-
("argilla",): "<@U0765RENPNZ>", # sara han diaz lorenzo
|
| 59 |
-
("distilabel",): "<@U0765RENPNZ>", # sara han diaz lorenzo
|
| 60 |
-
("dataset", "feedback"): "<@U0768RCHCRY>", # ben burtenshaw
|
| 61 |
-
("distilabel",): "<@U0768QEN0LA>", # Gabriel Martín Blázquez
|
| 62 |
-
("argilla",): "<@U0768QEN0LA>", # Gabriel Martín Blázquez
|
| 63 |
-
("distilabel",): "<@U076271MBUN>", # Agustín Piqueres
|
| 64 |
}
|
| 65 |
|
| 66 |
daily_pings = []
|
|
@@ -89,22 +79,23 @@ async def on_message(message):
|
|
| 89 |
|
| 90 |
huggingfolks_role = discord.utils.get(message.guild.roles, id=897376942817419265)
|
| 91 |
bots_role = discord.utils.get(message.guild.roles, id=1258328471609016341)
|
| 92 |
-
if huggingfolks_role not in message.author.roles:
|
| 93 |
-
if bots_role not in message.author.roles:
|
| 94 |
print(" not bot ")
|
| 95 |
content = message.content.lower()
|
| 96 |
-
|
| 97 |
-
for trigger,
|
| 98 |
-
if all(word in content for word in trigger):
|
| 99 |
adjacent_words = extract_adjacent_words(message.content, trigger)
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
| 108 |
print(f"daily pings:{daily_pings}")
|
| 109 |
|
| 110 |
# Check if the message is in a thread
|
|
|
|
| 28 |
ARGILLA_HELP_CHANNEL_ID = 1253640751481356330
|
| 29 |
DATA_DISCUSSIONS_CHANNEL_ID = 1217179426002047076
|
| 30 |
|
|
|
|
| 31 |
TRIGGERS = {
|
| 32 |
+
("discord bot",): ["<@U051DB2754M>"], # adam
|
| 33 |
+
("autotrain",): ["<@U01E3LEC2N7>"], # abhishek
|
| 34 |
+
("auto train",): ["<@U01E3LEC2N7>"], # abhishek
|
| 35 |
+
("competition",): ["<@U01E3LEC2N7>"], # abhishek
|
| 36 |
+
("competitions",): ["<@U01E3LEC2N7>"], # abhishek
|
| 37 |
+
("text to speech",): ["<@U039C2GANMV>"], # VB
|
| 38 |
+
("tts",): ["<@U039C2GANMV>"], # VB
|
| 39 |
+
("asr",): ["<@U039C2GANMV>"], # VB
|
| 40 |
+
("musicgen",): ["<@U039C2GANMV>"], # VB
|
| 41 |
+
("whisper",): ["<@U039C2GANMV>"], # VB
|
| 42 |
+
("speech recognition",): ["<@U039C2GANMV>"], # VB
|
| 43 |
+
("bark",): ["<@U039C2GANMV>"], # VB
|
| 44 |
+
("sentence-transformers",): ["<@U04E4DNPWG7>"], # tom aarsen
|
| 45 |
+
("sentence_transformers",): ["<@U04E4DNPWG7>"], # tom aarsen
|
| 46 |
+
("setfit",): ["<@U04E4DNPWG7>"], # tom aarsen
|
| 47 |
+
("sentence transformers",): ["<@U04E4DNPWG7>"], # tom aarsen
|
| 48 |
+
("argilla",): ["<@U076B8C7G3E>", "<@U0766H30T7F>", "<@U076MF65WEM>", "<@U0765RENPNZ>", "<@U0768QEN0LA>"], # david berenstein, natalia elvira, sara han diaz lorenzo, Gabriel Martín Blázquez
|
| 49 |
+
("distilabel",): ["<@U076B8C7G3E>", "<@U076MF65WEM>", "<@U0765RENPNZ>", "<@U0768QEN0LA>", "<@U076271MBUN>"], # david berenstein, sara han diaz lorenzo, Gabriel Martín Blázquez, Agustín Piqueres
|
| 50 |
+
("docs",): ["<@U02DATT4C5B>"], # steven liu
|
| 51 |
+
("documentation",): ["<@U02DATT4C5B>"], # steven liu
|
| 52 |
+
("gradio",): ["<@U02NMK75F1V>", "<@U04FLGQ26PQ>"], # abubakar abid, yuvraj sharma
|
| 53 |
+
("dataset", "feedback"): ["<@U0768RCHCRY>"], # ben burtenshaw
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
daily_pings = []
|
|
|
|
| 79 |
|
| 80 |
huggingfolks_role = discord.utils.get(message.guild.roles, id=897376942817419265)
|
| 81 |
bots_role = discord.utils.get(message.guild.roles, id=1258328471609016341)
|
| 82 |
+
if huggingfolks_role not in message.author.roles: # no need for ping if we're already discussing
|
| 83 |
+
if bots_role not in message.author.roles: # bots shouldn't trigger pings for this
|
| 84 |
print(" not bot ")
|
| 85 |
content = message.content.lower()
|
| 86 |
+
|
| 87 |
+
for trigger, mentions in TRIGGERS.items():
|
| 88 |
+
if all(word in content for word in trigger):
|
| 89 |
adjacent_words = extract_adjacent_words(message.content, trigger)
|
| 90 |
+
for slack_mention in mentions:
|
| 91 |
+
daily_pings.append({
|
| 92 |
+
'author': str(message.author),
|
| 93 |
+
'content': adjacent_words,
|
| 94 |
+
'channel': message.channel.name,
|
| 95 |
+
'url': message.jump_url,
|
| 96 |
+
'mention': slack_mention,
|
| 97 |
+
'trigger': trigger
|
| 98 |
+
})
|
| 99 |
print(f"daily pings:{daily_pings}")
|
| 100 |
|
| 101 |
# Check if the message is in a thread
|