mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	management: Add a command to send initial welcome bot messages.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							ac45a3f20d
						
					
				
				
					commit
					8ad4ecb3a2
				
			
							
								
								
									
										21
									
								
								zerver/management/commands/send_welcome_bot_message.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								zerver/management/commands/send_welcome_bot_message.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					from argparse import ArgumentParser
 | 
				
			||||||
 | 
					from typing import Any
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from zerver.lib.management import ZulipBaseCommand
 | 
				
			||||||
 | 
					from zerver.lib.onboarding import send_initial_pms
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Command(ZulipBaseCommand):
 | 
				
			||||||
 | 
					    help = """Sends the initial welcome bot message."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def handle(self, *args: Any, **options: str) -> None:
 | 
				
			||||||
 | 
					        for user_profile in self.get_users(options, self.get_realm(options), is_bot=False):
 | 
				
			||||||
 | 
					            send_initial_pms(user_profile)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user