correspond.notify#
Make a draft’s notify list a property of sending, not a rule a sender can forget.
A Draft may name who must be notified (Draft.notify).
Each writer then guarantees it in its platform’s terms: a mention added to the text
when it is absent (GitHub, Telegram), an address in To or Cc (email). A channel whose
capabilities.notify is none refuses such a draft with NotSupported("notify")
before anything is planned, so a notification is never silently dropped.
These helpers are pure: the writers call them while building the plan, so the dry run shows the exact text, or the exact Cc, that will go out.
>>> with_mentions("Fixed in #12.", ["octocat", "@hubot"])
'Fixed in #12.\n\ncc @octocat @hubot'
>>> with_mentions("Thanks @Octocat, fixed.", ["octocat"])
'Thanks @Octocat, fixed.'
Module Attributes
The line that carries the mentions a text lacked, before the handles. |
Functions
|
A handle without its leading |
|
Is |
|
The handles in |
|
|
|
|
- correspond.notify.DFLT_MENTION_LEAD = 'cc'#
The line that carries the mentions a text lacked, before the handles.
- correspond.notify.handle(name)[source]#
A handle without its leading
@.>>> handle("@octocat"), handle("octocat") ('octocat', 'octocat')
- Return type:
- correspond.notify.is_mentioned(text, name)[source]#
Is
@nameintextas a whole mention that notifies? Case-insensitive.Not inside an address or a longer handle, and not inside code or an HTML comment, where platforms render it without notifying anyone.
>>> is_mentioned("ping @octocat.", "octocat") True >>> is_mentioned("mail octocat@example.org", "octocat") False >>> is_mentioned("ping @octocat-two", "octocat") False >>> is_mentioned("see `@octocat` and <!-- @octocat -->", "octocat") False
- Return type:
- correspond.notify.missing_mentions(text, names)[source]#
The handles in
namesthattextdoes not mention yet, in order, each once.