diff --git a/RAAspotter.py b/RAAspotter.py index dbed7595a7175ba011c0fd4c73ef11777424dd50..1842a9f9a27a1394769c1cf7ea4b9694267e0956 100644 --- a/RAAspotter.py +++ b/RAAspotter.py @@ -66,6 +66,7 @@ class RAAspotter: self.smtp_configured = False self.mastodon = None self.mastodon_prefix = '' + self.mastodon_suffix = '' self.update_user_agent(user_agent) @@ -73,20 +74,23 @@ class RAAspotter: f.write('') f.close() - def configure_mastodon(self, access_token, instance, mastodon_prefix): + def configure_mastodon(self, access_token, instance, mastodon_prefix, mastodon_suffix): if (not access_token == "") and (not instance == ""): self.mastodon = Mastodon( access_token=access_token, api_base_url=instance ) self.mastodon_prefix = mastodon_prefix + self.mastodon_suffix = mastodon_suffix def mastodon_toot(self, content): if self.mastodon: + toot = content if not self.mastodon_prefix == '': - self.mastodon.toot(f"{self.mastodon_prefix}\n\n{content}") - else: - self.mastodon.toot(f"{content}") + toot = f"{self.mastodon_prefix}\n\n{toot}" + if not self.mastodon_suffix == '': + toot = f"{toot}\n\n{self.mastodon_suffix}" + self.mastodon.toot(toot) def enable_tor(self, max_requests=0): proxies = { diff --git a/ppparis.py b/ppparis.py index d938e6d412beccc7e637f2cdef0d5f76310b6d2e..78e324f427e89abcd85ff9510a4d8d1d72ac2d52 100755 --- a/ppparis.py +++ b/ppparis.py @@ -101,5 +101,5 @@ raa_spotter.not_before = __NOT_BEFORE raa_spotter.configure_mailer(__SMTP_HOSTNAME, __SMTP_USERNAME, __SMTP_PASSWORD, __SMTP_PORT, __SMTP_STARTTLS, __SMTP_SSL, __EMAIL_FROM, __EMAIL_TO, '[RAAspotter] [Préfecture de police de Paris] Nouveaux éléments trouvés') -raa_spotter.configure_mastodon(__MASTODON_ACCESS_TOKEN, __MASTODON_INSTANCE, '[Préfecture de police de Paris]') +raa_spotter.configure_mastodon(__MASTODON_ACCESS_TOKEN, __MASTODON_INSTANCE, '[Préfecture de police de Paris]', '#ppparis') raa_spotter.get_raa(__KEYWORDS) diff --git a/pref13.py b/pref13.py index 309d11db5a89a7595217c29fd6ceed012751b04c..54fca2b74b3420ed3f22c8186bbfde1003cd606e 100755 --- a/pref13.py +++ b/pref13.py @@ -101,5 +101,5 @@ raa_spotter.not_before = __NOT_BEFORE raa_spotter.configure_mailer(__SMTP_HOSTNAME, __SMTP_USERNAME, __SMTP_PASSWORD, __SMTP_PORT, __SMTP_STARTTLS, __SMTP_SSL, __EMAIL_FROM, __EMAIL_TO, '[RAAspotter] [Préfecture des Bouches-du-Rhône] Nouveaux éléments trouvés') -raa_spotter.configure_mastodon(__MASTODON_ACCESS_TOKEN, __MASTODON_INSTANCE, '[Préfecture des Bouches-du-Rhône]') +raa_spotter.configure_mastodon(__MASTODON_ACCESS_TOKEN, __MASTODON_INSTANCE, '[Préfecture des Bouches-du-Rhône]', '#pref13') raa_spotter.get_raa(__KEYWORDS) diff --git a/pref35.py b/pref35.py index 4e9603cff490f69346505ea92fac6068104945fc..d89db8b67ed4a40a804033011b2edaa7544ae188 100755 --- a/pref35.py +++ b/pref35.py @@ -101,5 +101,5 @@ raa_spotter.not_before = __NOT_BEFORE raa_spotter.configure_mailer(__SMTP_HOSTNAME, __SMTP_USERNAME, __SMTP_PASSWORD, __SMTP_PORT, __SMTP_STARTTLS, __SMTP_SSL, __EMAIL_FROM, __EMAIL_TO, '[RAAspotter] [Préfecture d\'Ille-et-Vilaine] Nouveaux éléments trouvés') -raa_spotter.configure_mastodon(__MASTODON_ACCESS_TOKEN, __MASTODON_INSTANCE, '[Préfecture d\'Ille-et-Vilaine]') +raa_spotter.configure_mastodon(__MASTODON_ACCESS_TOKEN, __MASTODON_INSTANCE, '[Préfecture d\'Ille-et-Vilaine]', '#pref35') raa_spotter.get_raa(__KEYWORDS)