2023-03-21 18:40:42 +01:00
|
|
|
from argparse import ArgumentParser
|
|
|
|
from typing import Any
|
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
from typing_extensions import override
|
|
|
|
|
2023-03-21 18:40:42 +01:00
|
|
|
from zerver.lib.management import ZulipBaseCommand
|
2023-05-01 18:01:47 +02:00
|
|
|
from zerver.lib.onboarding import send_initial_direct_message
|
2023-03-21 18:40:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Command(ZulipBaseCommand):
|
|
|
|
help = """Sends the initial welcome bot message."""
|
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2023-03-21 18:40:42 +01:00
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
|
|
self.add_user_list_args(
|
|
|
|
parser,
|
|
|
|
help="Email addresses of user(s) to send welcome bot messages to.",
|
|
|
|
all_users_help="Send to every user on the realm.",
|
|
|
|
)
|
|
|
|
self.add_realm_args(parser)
|
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2023-03-21 18:40:42 +01:00
|
|
|
def handle(self, *args: Any, **options: str) -> None:
|
|
|
|
for user_profile in self.get_users(options, self.get_realm(options), is_bot=False):
|
2023-05-01 18:01:47 +02:00
|
|
|
send_initial_direct_message(user_profile)
|