Skip to content

Instantly share code, notes, and snippets.

@davidteather
Last active April 6, 2020 03:45
Show Gist options
  • Save davidteather/1482259c39e0ad668ac8c3240c99e753 to your computer and use it in GitHub Desktop.
Save davidteather/1482259c39e0ad668ac8c3240c99e753 to your computer and use it in GitHub Desktop.
Mention Members using GroupyAPI
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