Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings improvements #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions apps/happy_birthder/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.',

Expand Down Expand Up @@ -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:'
4 changes: 1 addition & 3 deletions apps/happy_birthder/happy_birthder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. """
Expand Down
38 changes: 3 additions & 35 deletions apps/happy_birthder/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Settings for HappyBirthder application. """

import os

from apps.happy_birthder.defaults import * # pylint: disable=wildcard-import,unused-wildcard-import
Expand All @@ -16,6 +17,7 @@

PG_USER = os.environ['PG_USER']


# HappyBirthder
BIRTHDAY_CHANNEL_TTL = int(os.getenv('BIRTHDAY_CHANNEL_TTL', '7'))

Expand All @@ -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/')
Expand All @@ -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 * * *')
2 changes: 0 additions & 2 deletions apps/holidays/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
SCHEDULER_SETTINGS = {
'apscheduler.timezone': TIME_ZONE,
}

XML_CALENDAR_HOST = 'http://xmlcalendar.ru'
3 changes: 3 additions & 0 deletions apps/holidays/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 * * *')

Expand Down
6 changes: 6 additions & 0 deletions meeseeks/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
Expand Down
4 changes: 0 additions & 4 deletions meeseeks/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Loading