perf: 支持slack通知和认证 (#12193)

* perf: 支持slack通知和认证

* perf: 生成迁移文件

* perf: 优化获取access_token逻辑

---------

Co-authored-by: jiangweidong <weidong.jiang@fit2cloud.com>
This commit is contained in:
fit2bot
2023-11-29 17:45:44 +08:00
committed by GitHub
parent 575562c416
commit 0fdae00722
26 changed files with 523 additions and 114 deletions

View File

@@ -0,0 +1,21 @@
from django.conf import settings
from common.sdk.im.slack import Slack as Client
from .base import BackendBase
class Slack(BackendBase):
account_field = 'slack_id'
is_enable_field_in_settings = 'AUTH_SLACK'
def __init__(self):
self.client = Client(
bot_token=settings.SLACK_BOT_TOKEN,
)
def send_msg(self, users, message, subject=None):
accounts, __, __ = self.get_accounts(users)
return self.client.send_text(accounts, message)
backend = Slack