From 06881a4c70e195b5a789a307c38ddfdc1c524f1d Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 31 Jan 2019 19:56:35 +0100 Subject: [PATCH] Add `formatMentions` docstring --- fbchat/models.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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