diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 14496ba..41abed4 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -40,7 +40,6 @@ jobs: ROCKET_CHAT_API: http://localhost:8006/api/v1 USER_NAME: meeseeks PASSWORD: testpassword - COMPANY_NAME: TestCompany PG_NAME: happy_birthder_base PG_HOST: localhost PG_PORT: 5432 diff --git a/apps/happy_birthder/defaults.py b/apps/happy_birthder/defaults.py index 0471e4f..a9e0d56 100644 --- a/apps/happy_birthder/defaults.py +++ b/apps/happy_birthder/defaults.py @@ -2,6 +2,8 @@ from meeseeks.settings import * # pylint: disable=wildcard-import, unused-wildcard-import +ANNIVERSARY = 'I’m glad to announce that today is an anniversary for some of us! :tada:' + CONGRATULATION_PHRASES = [ 'May this year bring with it all the success and fulfillment your heart desires.', @@ -39,3 +41,19 @@ 'thesimpsonsbirthday', 'tmntbirthday', ] + +GREETINGS_RESPONSE = 'Welcome to CusDeb Solutions! :tada: Emm... where was I? Oh!' + +NOTIFY_SET_AVATAR = ( + 'Oh, I see you didn`t set your avatar!\nPlease, do it as soon as possible. :grin:' +) + +NOTIFY_SET_BIRTH_DATE = ( + 'Hmm…\nIt looks like you forgot to set the date of birth.\nPlease enter it (DD.MM.YYYY).' +) + +PERSONS_WITHOUT_BIRTHDAY_RESPONSE = 'These persons did not provide date of birth.' + +PERSONS_WITHOUT_AVATAR_RESPONSE = 'These users didn`t set their avatars.' + +SET_BIRTHDAY_RESPONSE = 'I memorized you birthday, well done! :wink:' diff --git a/apps/happy_birthder/happy_birthder.py b/apps/happy_birthder/happy_birthder.py index cd3633a..771a55b 100644 --- a/apps/happy_birthder/happy_birthder.py +++ b/apps/happy_birthder/happy_birthder.py @@ -234,9 +234,7 @@ async def check_dates(self): settings.BIRTHDAY_LOGGING_CHANNEL) if users_anniversary: - await self._restapi.write_msg( - 'I am glad to announce that today is the day of anniversary for some of us!:tada:' + - users_anniversary, 'GENERAL') + await self._restapi.write_msg(settings.ANNIVERSARY + users_anniversary, 'GENERAL') async def scheduler_jobs(self): """Wraps scheduler jobs. """ diff --git a/apps/happy_birthder/settings.py b/apps/happy_birthder/settings.py index 637341e..9facaff 100644 --- a/apps/happy_birthder/settings.py +++ b/apps/happy_birthder/settings.py @@ -1,4 +1,5 @@ """Settings for HappyBirthder application. """ + import os from apps.happy_birthder.defaults import * # pylint: disable=wildcard-import,unused-wildcard-import @@ -16,6 +17,7 @@ PG_USER = os.environ['PG_USER'] + # HappyBirthder BIRTHDAY_CHANNEL_TTL = int(os.getenv('BIRTHDAY_CHANNEL_TTL', '7')) @@ -25,44 +27,10 @@ CREATE_BIRTHDAY_CHANNELS = os.getenv('CREATE_BIRTHDAY_CHANNELS', '').lower() == 'true' -COMPANY_NAME = os.environ['COMPANY_NAME'] - -GREETINGS_RESPONSE = os.getenv( - 'GREETINGS_RESPONSE', - f'Welcome to {COMPANY_NAME}!' -) - -NOTIFY_SET_AVATAR = os.getenv( - 'NOTIFY_SET_AVATAR', - "Oh, I see you didn't set your avatar!\nPlease, do it as soon as possible. :grin:", -) - -NOTIFY_SET_BIRTH_DATE = os.getenv( - 'NOTIFY_SET_BIRTH_DATE', - 'Hmm…\nIt looks like you forgot to set the date of birth.' - '\nPlease enter it (DD.MM.YYYY).' -) - NUMBER_OF_DAYS_IN_ADVANCE = int(os.getenv('NUMBER_OF_DAYS_IN_ADVANCE', '7')) -PERSONS_WITHOUT_BIRTHDAY_RESPONSE = os.getenv('PERSONS_WITHOUT_BIRTHDAY_RESPONSE', - 'These persons did not provide date of birth.') - -PERSONS_WITHOUT_AVATAR_RESPONSE = os.getenv( - 'PERSONS_WITHOUT_AVATAR_RESPONSE', - "These users didn't set their avatars.", -) - -SET_BIRTHDAY_RESPONSE = os.getenv( - 'SET_BIRTHDAY_RESPONSE', - 'I memorized you birthday, well done! :wink:' -) # TenorAPI -_CONGRATULATION_PHRASES = os.getenv('CONGRATULATION_PHRASES') -CONGRATULATION_PHRASES = (_CONGRATULATION_PHRASES.split(',') if _CONGRATULATION_PHRASES - else CONGRATULATION_PHRASES) - TENOR_API_KEY = os.environ['TENOR_API_KEY'] TENOR_API_URL = os.getenv('TENOR_API_URL', 'https://api.tenor.com/v1/') @@ -72,10 +40,10 @@ _TENOR_SEARCH_TERM = os.getenv('TENOR_SEARCH_TERM') TENOR_SEARCH_TERM = (_TENOR_SEARCH_TERM.split(',') if _TENOR_SEARCH_TERM else TENOR_SEARCH_TERM) - _TENOR_BLACKLISTED_GIF_IDS = os.getenv('TENOR_BLACKLISTED_GIF_IDS') TENOR_BLACKLISTED_GIF_IDS = (_TENOR_BLACKLISTED_GIF_IDS.split(',') if _TENOR_BLACKLISTED_GIF_IDS else []) + # Scheduler HB_CRONTAB = os.getenv('HB_CRONTAB', '0 0 7 * * *') diff --git a/apps/holidays/defaults.py b/apps/holidays/defaults.py index 1a77af9..232b64c 100644 --- a/apps/holidays/defaults.py +++ b/apps/holidays/defaults.py @@ -5,5 +5,3 @@ SCHEDULER_SETTINGS = { 'apscheduler.timezone': TIME_ZONE, } - -XML_CALENDAR_HOST = 'http://xmlcalendar.ru' diff --git a/apps/holidays/settings.py b/apps/holidays/settings.py index 14e888e..4c749e9 100644 --- a/apps/holidays/settings.py +++ b/apps/holidays/settings.py @@ -7,8 +7,11 @@ load_dotenv() # Holidays settings +XML_CALENDAR_HOST = os.getenv('XML_CALENDAR_HOST', 'http://xmlcalendar.ru') + CUSTOM_HOLIDAYS = os.getenv('CUSTOM_HOLIDAYS', '') + # Scheduler HOLIDAYS_CRONTAB_WEEK_BEFORE = os.getenv('HOLIDAYS_CRONTAB_WEEK_BEFORE', '0 0 7 * * *') diff --git a/meeseeks/defaults.py b/meeseeks/defaults.py index 2eb0269..792d6f9 100644 --- a/meeseeks/defaults.py +++ b/meeseeks/defaults.py @@ -8,8 +8,14 @@ 'apps.VoteOrDie', ) +HELLO_RESPONSE = 'Hello world!' + RC_REALTIME_LOGIN = 'login' +TIME_ZONE = 'Europe/Moscow' + + +# Rocket.Chat API endpoints CHAT_MESSAGE_POST_REQUEST = '/chat.postMessage/' CHAT_REACT_POST_REQUEST = '/chat.react/' diff --git a/meeseeks/settings.py b/meeseeks/settings.py index ae8afe0..c1ac804 100644 --- a/meeseeks/settings.py +++ b/meeseeks/settings.py @@ -18,7 +18,3 @@ USER_NAME = os.environ['USER_NAME'] CONNECT_ATTEMPTS = int(os.getenv('CONNECT_ATTEMPTS', '5')) - -HELLO_RESPONSE = os.getenv('HELLO_RESPONSE', 'Hello my friend') - -TIME_ZONE = os.getenv('TIME_ZONE', 'Europe/Moscow')