Load hooks from file
This commit is contained in:
		
							parent
							
								
									20ede6e02a
								
							
						
					
					
						commit
						5af780b3bc
					
				| @ -73,13 +73,6 @@ webhook = config['webhook'] | |||||||
| 
 | 
 | ||||||
| message = args.message | message = args.message | ||||||
| 
 | 
 | ||||||
| notify = None |  | ||||||
| if args.notify is None: |  | ||||||
|     if config.get('notify') is not None: |  | ||||||
|         notify = config.get('notify') |  | ||||||
| else: |  | ||||||
|     notify = args.notify |  | ||||||
| 
 |  | ||||||
| ran = False | ran = False | ||||||
| 
 | 
 | ||||||
| if args.pid != 0: | if args.pid != 0: | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								server/src/hooks.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								server/src/hooks.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | --- | ||||||
|  | 2345555XE: "#Bottest" | ||||||
| @ -3,12 +3,16 @@ from flask import Flask, request, jsonify | |||||||
| # import asyncio | # import asyncio | ||||||
| import websocket | import websocket | ||||||
| import json | import json | ||||||
|  | import yaml | ||||||
| import random | import random | ||||||
| 
 | 
 | ||||||
| app = Flask(__name__) | app = Flask(__name__) | ||||||
| 
 | 
 | ||||||
| hooks = {} | hooks = {} | ||||||
| hooks['2345555XE'] = '#Bottest' | with open(r'hooks.yml') as hooksfile: | ||||||
|  |     hooks = yaml.load(hooksfile, Loader=yaml.FullLoader) | ||||||
|  | print(hooks) | ||||||
|  | #hooks['2345555XE'] = '#Bottest' | ||||||
| 
 | 
 | ||||||
| def sendmessage(target, message): | def sendmessage(target, message): | ||||||
|     print("Sendmessage %s called to %s" % (message, target)) |     print("Sendmessage %s called to %s" % (message, target)) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user