diff --git a/fbchat/models.py b/fbchat/models.py index c7f5d77..ab0dbab 100644 --- a/fbchat/models.py +++ b/fbchat/models.py @@ -210,6 +210,18 @@ class Message(object): @classmethod def formatMentions(cls, text, *args, **kwargs): + """Like `str.format`, but takes tuples with a thread id and text instead. + + Returns a `Message` object, with the formatted string and relevant mentions. + + ``` + >>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) + , ] emoji_size=None attachments=[]> + + >>> Message.formatMentions("Hey {p}! My name is {}", ("1234", "Michael"), p=("4321", "Peter")) + , ] emoji_size=None attachments=[]> + ``` + """ result = "" mentions = list() offset = 0