Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
send_hub_org_dm_retroactive
Browse files
app.py
CHANGED
@@ -540,7 +540,7 @@ async def on_message(message):
|
|
540 |
if role in member.roles:
|
541 |
print(f"Updated hf_user_name for id {member.id} | discord_user_name {member} | hf_user_name {user['name']}")
|
542 |
await message.channel.send(f"Verification successful! [{member} <---> {user['name']}] π€ {org_link} {invite_message}")
|
543 |
-
await lunar.send(f"Verification successful! [{member} <---> {user['name']}] π€ {org_link} {invite_message}")
|
544 |
print(f"Verification successful! [{member} <---> {user['name']}] π€")
|
545 |
return
|
546 |
else:
|
@@ -682,6 +682,24 @@ async def count_users_with_role(ctx, role_id):
|
|
682 |
await ctx.send(f"Number of users with the role '{role.name}': {count}")
|
683 |
|
684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
686 |
def run_bot():
|
687 |
bot.run(DISCORD_TOKEN)
|
|
|
540 |
if role in member.roles:
|
541 |
print(f"Updated hf_user_name for id {member.id} | discord_user_name {member} | hf_user_name {user['name']}")
|
542 |
await message.channel.send(f"Verification successful! [{member} <---> {user['name']}] π€ {org_link} {invite_message}")
|
543 |
+
await lunar.send(f"Verification successful! [{member} <---> {user['name']}] \nπ€ {org_link} {invite_message}")
|
544 |
print(f"Verification successful! [{member} <---> {user['name']}] π€")
|
545 |
return
|
546 |
else:
|
|
|
682 |
await ctx.send(f"Number of users with the role '{role.name}': {count}")
|
683 |
|
684 |
|
685 |
+
@bot.command()
|
686 |
+
async def send_hub_org_dm_retroactive(ctx, role_id):
|
687 |
+
if ctx.author.id == 811235357663297546:
|
688 |
+
lunar = bot.get_user(811235357663297546)
|
689 |
+
role = discord.utils.get(ctx.guild.roles, id=int(role_id))
|
690 |
+
# for every person with this role
|
691 |
+
# dm them message with link
|
692 |
+
if role:
|
693 |
+
for member in role.members:
|
694 |
+
try:
|
695 |
+
dm_message = f"Hey {member}! You've just been invited to join the Hugging Face Discord Community org! π€\n If you're interested in collaborating on open source projects, hanging out with the community or just enjoying your new badge, we're happy to have you! β€οΈ"
|
696 |
+
await lunar.send(dm_message)
|
697 |
+
except discord.Forbidden:
|
698 |
+
print(f"Could not DM {member.name}")
|
699 |
+
await lunar.send(f"Could not DM {member.name} a Hugging Face Org invite link")
|
700 |
+
|
701 |
+
|
702 |
+
|
703 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
704 |
def run_bot():
|
705 |
bot.run(DISCORD_TOKEN)
|