Last active
April 6, 2020 03:45
-
-
Save davidteather/1482259c39e0ad668ac8c3240c99e753 to your computer and use it in GitHub Desktop.
Mention Members using GroupyAPI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groupID = "groupID" | |
targetToTag = "David Teather" | |
group = client.groups.get(groupID) | |
def tagMembers(message, mentions): | |
loci = [message.index(mentions.name)-1, message.index(mentions.name) + len(mentions.name)-1] | |
return attachments.Mentions([loci], [mentions.user_id]) | |
for member in group.members: | |
if member.name == targetToTag: | |
msg = "epic @" + targetToTag | |
att = tagMembers(msg, member) | |
group.post(text=msg, attachments=[att]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment