Remove dbsettings from init methods (would prevent initial migrations)

This commit is contained in:
Kumi 2021-03-01 07:09:53 +01:00
parent ca56b250f7
commit efc6e1c326
2 changed files with 6 additions and 5 deletions

View file

@ -13,10 +13,10 @@ from ..models import GatewayUser
from ..helpers import run_filters
class MatrixDispatcher:
def __init__(self, username=dbsettings.MATRIX_USERNAME, password=dbsettings.MATRIX_PASSWORD, homeserver=dbsettings.MATRIX_HOMESERVER):
self.username = username
self.password = password
self.homeserver = homeserver
def __init__(self, username=None, password=None, homeserver=None):
self.username = username or dbsettings.MATRIX_USERNAME
self.password = password or dbsettings.MATRIX_PASSWORD
self.homeserver = homeserver or dbsettings.MATRIX_HOMESERVER
async def send(self, message, room_id):
client = AsyncClient(self.homeserver, self.username)

View file

@ -16,7 +16,8 @@ class TelegramWebhookView(View):
pass # TODO: Implement webhook receiver and management tool
class TelegramDispatcher:
def __init__(self, token=dbsettings.TELEGRAM_TOKEN):
def __init__(self, token=None):
token = token or dbsettings.TELEGRAM_TOKEN
self.bot = telegram.Bot(token=token)
def send(self, message, chat_id):