2024-04-09 17:19:32 +02:00
|
|
|
from argparse import ArgumentParser
|
2024-02-05 17:12:55 +01:00
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
from typing_extensions import override
|
|
|
|
|
2024-04-23 20:58:26 +02:00
|
|
|
from zerver.lib.management import ZulipBaseCommand, abort_unless_locked
|
2024-02-05 17:12:55 +01:00
|
|
|
from zerver.lib.zulip_update_announcements import send_zulip_update_announcements
|
|
|
|
|
|
|
|
|
|
|
|
class Command(ZulipBaseCommand):
|
|
|
|
help = """Script to send zulip update announcements to realms."""
|
|
|
|
|
|
|
|
@override
|
2024-04-09 17:19:32 +02:00
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
|
|
parser.add_argument(
|
|
|
|
"--skip-delay",
|
|
|
|
action="store_true",
|
|
|
|
help="Immediately send updates if 'zulip_update_announcements_stream' is configured.",
|
|
|
|
)
|
|
|
|
|
|
|
|
@override
|
2024-04-23 20:58:26 +02:00
|
|
|
@abort_unless_locked
|
2024-04-09 17:19:32 +02:00
|
|
|
def handle(self, *args: Any, **options: Any) -> None:
|
2024-04-23 20:58:26 +02:00
|
|
|
send_zulip_update_announcements(skip_delay=options["skip_delay"])
|