diff --git a/Pipfile b/Pipfile index 022e6ee..3e3a562 100644 --- a/Pipfile +++ b/Pipfile @@ -13,7 +13,6 @@ google-auth-httplib2 = "*" google-auth-oauthlib = "*" requests = "*" igramscraper = "*" -twitterscraper = "*" httpx = "*" PyYAML = "==5.3" wolframalpha = "*" diff --git a/README.md b/README.md index 020e68d..5a87a96 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,8 @@ Commands: * !googlecal del [calendar id] - Delete calendar from room (Must be done as room admin) * !googlecal list - List calendars in this room +NOTE: disabled by default + ### Cron Can schedule things to be done. @@ -187,7 +189,7 @@ New posts are sent to room. Polls only randomly every 30 to 60 minutes to keep Commands: -Prefix with selected service, for example "!ig add accountname" or "!twitter list" +Prefix with selected service, for example "!ig add accountname" or "!teamup list" * add [accountname] - Add account to this room (Must be done as room admin) * del [accountname] - Delete account from room (Must be done as room admin) @@ -203,12 +205,7 @@ without any authentication or api key. See: https://github.com/realsirjoe/instagram-scraper/ -#### Twitter - -Polls twitter account(s). Uses twitter scraper library -without any authentication or api key. - -See: https://github.com/taspinar/twitterscraper/tree/master/twitterscraper +NOTE: disabled by default #### Matrix Messaging API (mxma) @@ -269,6 +266,8 @@ Example: * !url status +NOTE: Disabled by default, i.e. you also need to enable it before activating it + ### Cmd Can be used to pre-configure shell commands run by bot. This is easy way to add @@ -373,6 +372,8 @@ bot ownership) * !flog rmlive - disable live field log for this room * !flog timezone 3 - set timezone (relative to UTC, see API docs) +NOTE: disabled by default + ### Jitsi If enabled, Jitsi calls created with Matrix clients will be sent as text messages diff --git a/modules/common/pollingservice.py b/modules/common/pollingservice.py index 6108df3..86ae0e7 100644 --- a/modules/common/pollingservice.py +++ b/modules/common/pollingservice.py @@ -17,7 +17,7 @@ class PollingService(BotModule): self.send_all = False # Set to true to send all received items, even on first sync async def matrix_poll(self, bot, pollcount): - if len(self.account_rooms): + if self.enabled and len(self.account_rooms): await self.poll_all_accounts(bot) async def poll_all_accounts(self, bot): diff --git a/modules/flog.py b/modules/flog.py index 47a8abe..0f52f3b 100644 --- a/modules/flog.py +++ b/modules/flog.py @@ -21,6 +21,7 @@ class MatrixModule(BotModule): self.logged_flights = [] self.logged_flights_date = "" self.first_poll = True + self.enabled = False async def matrix_poll(self, bot, pollcount): if len(self.api_key) > 0: diff --git a/modules/googlecal.py b/modules/googlecal.py index 37b7817..588f506 100644 --- a/modules/googlecal.py +++ b/modules/googlecal.py @@ -27,6 +27,7 @@ class MatrixModule(BotModule): self.bot = None self.service = None self.calendar_rooms = dict() # Contains room_id -> [calid, calid] .. + self.enabled = False def matrix_start(self, bot): super().matrix_start(bot) diff --git a/modules/ig.py b/modules/ig.py index 09d9764..83de68d 100644 --- a/modules/ig.py +++ b/modules/ig.py @@ -15,6 +15,7 @@ class MatrixModule(PollingService): super().__init__(name) self.instagram = Instagram() self.service_name = 'Instagram' + self.enabled = False async def poll_implementation(self, bot, account, roomid, send_messages): try: diff --git a/modules/twitter.py b/modules/twitter.py deleted file mode 100644 index 49f20bb..0000000 --- a/modules/twitter.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -import traceback - -from twitterscraper import query_tweets_from_user - -from modules.common.pollingservice import PollingService - - -# https://github.com/taspinar/twitterscraper/tree/master/twitterscraper - -class MatrixModule(PollingService): - def __init__(self, name): - super().__init__(name) - self.service_name = 'Twitter' - - async def poll_implementation(self, bot, account, roomid, send_messages): - try: - tweets = query_tweets_from_user(account, limit=1) - self.logger.info(f'Polling twitter account {account} - got {len(tweets)} tweets') - for tweet in tweets: - if tweet.tweet_id not in self.known_ids: - if send_messages: - await bot.send_html(bot.get_room_by_id(roomid), - f'Twitter {account}: {tweet.text}', - f'Twitter {account}: {tweet.text} - https://twitter.com{tweet.tweet_url}') - self.known_ids.add(tweet.tweet_id) - except Exception: - self.logger.error('Polling twitter account failed:') - traceback.print_exc(file=sys.stderr) diff --git a/modules/url.py b/modules/url.py index cf694a5..68c67ce 100644 --- a/modules/url.py +++ b/modules/url.py @@ -34,6 +34,8 @@ class MatrixModule(BotModule): "BOTH": "Spamming this channel with both title and description", } + self.enabled = False + def matrix_start(self, bot): """ Register callback for all RoomMessageText events on startup