mirror of
				https://gitlab.com/ceda_ei/the-long-night
				synced 2025-10-31 22:40:06 +01:00 
			
		
		
		
	Add telegram backend for sending messages.
This commit is contained in:
		
							
								
								
									
										0
									
								
								backends/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								backends/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										11
									
								
								backends/telegram.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backends/telegram.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | import requests | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def send(tg_config, message): | ||||||
|  |     url = "https://api.telegram.org/bot{}/sendMessage".format( | ||||||
|  |         tg_config["bot_token"]) | ||||||
|  |     data = { | ||||||
|  |         "chat_id": tg_config["user_id"], | ||||||
|  |         "text": message | ||||||
|  |     } | ||||||
|  |     requests.post(url, data=data) | ||||||
		Reference in New Issue
	
	Block a user