diff --git a/settings.json.example b/settings.json.example index 9004d01..a3047c6 100644 --- a/settings.json.example +++ b/settings.json.example @@ -13,6 +13,7 @@ "pg_pass": "secret_password", "pg_port": "5432", "redis_host": "localhost", + "ignored": [], "irc_servers": { "your custom name for the farm": { "domains": ["wikipedia.org", "otherwikipedia.org"], @@ -23,6 +24,15 @@ "irc_channel_mapping": {"rc": "#rcchannel", "discussion": "#discussionchannel"} } }, + "appearance":{ + "mode": "whatever", + "embed": { + "show_edit_changes": true, + "show_footer": true, + "embed_images": true, + "show_no_description_provided": true + } + }, "logging": { "version": 1, "disable_existing_loggers": false, diff --git a/src/domain.py b/src/domain.py index 691d460..6381065 100644 --- a/src/domain.py +++ b/src/domain.py @@ -56,7 +56,7 @@ class Domain: if self.task: self.task.cancel() - def get_wiki(self, item, default=None) -> Optional[src.wiki.Wiki]: + def get_wiki(self, item: str, default=None) -> Optional[src.wiki.Wiki]: """Return a wiki with given domain name""" return self.wikis.get(item, default) diff --git a/src/domain_manager.py b/src/domain_manager.py index 58a6d27..6ca1a39 100644 --- a/src/domain_manager.py +++ b/src/domain_manager.py @@ -48,6 +48,8 @@ class DomainManager: for name, domain in self.domains.items(): logger.info("{name} - Status: {status}, exception: {exception}".format(name=name, status=domain.task.done(), exception=domain.task.print_stack())) + if self.check_for_domain(self.get_domain(split_payload[1])): + logger.info(str(self.return_domain(self.get_domain(split_payload[1])).get_wiki(split_payload[1]))) else: raise ValueError("Unknown pub/sub command! Payload: {}".format(payload)) diff --git a/src/statistics.py b/src/statistics.py index c09de6f..38977fd 100644 --- a/src/statistics.py +++ b/src/statistics.py @@ -54,6 +54,9 @@ class Statistics: self.last_post: Optional[str] = discussion_id self.logs: LimitedList[Log] = LimitedList() + def __str__(self): + return f"" + def update(self, *args: Log, **kwargs: Union[float, int, str]): for key, value in kwargs.items(): self.__setattr__(key, value) diff --git a/src/wiki.py b/src/wiki.py index e04212b..d7c7c43 100644 --- a/src/wiki.py +++ b/src/wiki.py @@ -55,6 +55,14 @@ class Wiki: self.session_requests = requests.Session() self.session_requests.headers.update(settings["header"]) + def __str__(self): + return self.__repr__() + + def __repr__(self): + return ( + f"") + @property def rc_id(self): return self.statistics.last_action