mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
reminder_bot: Add infra for adding reminder bot to every realm.
This commit is contained in:
@@ -4,11 +4,24 @@ from django.conf import settings
|
||||
from zerver.lib.actions import set_default_streams, bulk_add_subscriptions, \
|
||||
internal_prep_stream_message, internal_send_private_message, \
|
||||
create_stream_if_needed, create_streams_if_needed, do_send_messages, \
|
||||
do_add_reaction_legacy
|
||||
do_add_reaction_legacy, create_users
|
||||
from zerver.models import Realm, UserProfile, Message, Reaction, get_system_bot
|
||||
|
||||
from typing import Any, Dict, List, Mapping, Text
|
||||
|
||||
def setup_realm_internal_bots(realm: Realm) -> None:
|
||||
internal_bots = [(bot['name'], bot['email_template'] % (settings.INTERNAL_BOT_DOMAIN,))
|
||||
for bot in settings.REALM_INTERNAL_BOTS]
|
||||
create_users(realm, internal_bots, bot_type=UserProfile.DEFAULT_BOT)
|
||||
bots = UserProfile.objects.filter(
|
||||
realm=realm,
|
||||
email__in=[bot_info[1] for bot_info in internal_bots],
|
||||
bot_owner__isnull=True
|
||||
)
|
||||
for bot in bots:
|
||||
bot.bot_owner = bot
|
||||
bot.save()
|
||||
|
||||
def send_initial_pms(user: UserProfile) -> None:
|
||||
organization_setup_text = ""
|
||||
if user.is_realm_admin:
|
||||
|
||||
Reference in New Issue
Block a user