mirror of
				https://gitlab.com/akasroua/covot
				synced 2025-11-04 02:39:50 +01:00 
			
		
		
		
	Add greeting message
This commit is contained in:
		
							parent
							
								
									5d0424045d
								
							
						
					
					
						commit
						7b2981bb8c
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					src/constants.py
 | 
				
			||||||
							
								
								
									
										13
									
								
								shell.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								shell.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					{ pkgs ? import <nixpkgs> { } }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					with pkgs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mkShell {
 | 
				
			||||||
 | 
					  buildInputs = [
 | 
				
			||||||
 | 
					    python38
 | 
				
			||||||
 | 
					    python38Packages.python-telegram-bot
 | 
				
			||||||
 | 
					    python38Packages.aiosmtpd
 | 
				
			||||||
 | 
					    python38Packages.pytest
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										31
									
								
								src/bot.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/bot.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					from telegram.ext import Updater, CommandHandler
 | 
				
			||||||
 | 
					from constants import TOKEN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def initialize_bot():
 | 
				
			||||||
 | 
					    updater = Updater(token=TOKEN, use_context=True)
 | 
				
			||||||
 | 
					    dispatcher = updater.dispatcher
 | 
				
			||||||
 | 
					    return updater, dispatcher
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def start_callback(update, context):
 | 
				
			||||||
 | 
					    context.bot.send_message(
 | 
				
			||||||
 | 
					        chat_id=update.effective_chat.id,
 | 
				
			||||||
 | 
					        text="Hola, muy buenas. Gracias por ponerte en contacto con UGR Tracing Bot. Para poder continuar con el proceso por favor responda a este mensaje con un identificador único (DNI o correo institucional). Muchas gracias.",
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def add_callbacks(dispatcher):
 | 
				
			||||||
 | 
					    start_handler = CommandHandler("start", start_callback)
 | 
				
			||||||
 | 
					    dispatcher.add_handler(start_handler)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def main():
 | 
				
			||||||
 | 
					    updater, dispatcher = initialize_bot()
 | 
				
			||||||
 | 
					    add_callbacks(dispatcher)
 | 
				
			||||||
 | 
					    updater.start_polling()
 | 
				
			||||||
 | 
					    updater.idle()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    main()
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user