diff --git a/docs/API spec.md b/docs/API spec.md index 4e331bb..0ce6278 100644 --- a/docs/API spec.md +++ b/docs/API spec.md @@ -112,9 +112,10 @@ Context can consist of the following fields: - `client` - [Client](#Client) object - `webhook_url` - string - webhook url for given formatter - `message_type` - string - can be either `embed` or `compact` +- `feed_type` - string - type of the feed, can be either `recentchanges`, `abuselog` or `discussion` +- `event` - string - action called, should be the same as formatter event action - `categories` - {"new": set(), "removed": set()} - each set containing strings of added or removed categories for given page - `parsedcomment` - string - contains escaped and Markdown parsed summary (parsed_comment) of a log/edit action -- `event` - string - action called, should be the same as formatter event action - `comment_page` - dict - containing `fullUrl` and `article` with strings both to full article url and its name ### Util @@ -148,4 +149,4 @@ RcGcDw implements i18n with gettext and already exposes Translations instance wi **Path**: `src.api.hook` There are two decorator functions available in the module: `pre_hook` and `post_hook`. They don't take arguments and simply register the function as a hook. Pre-hook functions take the following arguments: `context` ([Context object](#Context)) and `change` (dict object with change). -Post-hook functions take the following arguments: `message` ([Discord message object](#DiscordMessage)), `metadata` ([Discord message metadata](#DiscordMessageMetadata)), `context` ([Context object](#Context)) and `change` (dictionary of main change body) \ No newline at end of file +Post-hook functions take the following arguments: `message` ([Discord message object](#DiscordMessage)), `metadata` ([Discord message metadata](#DiscordMessageMetadata)), `context` ([Context object](#Context)) and `change` (dictionary of main change body) diff --git a/src/api/context.py b/src/api/context.py index e469eae..8e38cc9 100644 --- a/src/api/context.py +++ b/src/api/context.py @@ -22,10 +22,11 @@ if TYPE_CHECKING: class Context: """Context object containing client and some metadata regarding specific formatter call, they are mainly used as a bridge between part that fetches the changes and API's formatters""" - def __init__(self, message_type: str, webhook_url: str, client: Client): + def __init__(self, message_type: str, feed_type: str, webhook_url: str, client: Client): self.client = client self.webhook_url = webhook_url self.message_type = message_type + self.feed_type = feed_type self.categories = None self.parsedcomment = None self.event = None @@ -41,4 +42,4 @@ class Context: self.comment_page = page def __str__(self): - return f"