get rid of defaults, hardcode stuff instead, also use os.chdir into config dir
This commit is contained in:
		
							parent
							
								
									acc390ef11
								
							
						
					
					
						commit
						9eeabd8ae9
					
				
					 4 changed files with 7 additions and 17 deletions
				
			
		
							
								
								
									
										7
									
								
								pgbot
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								pgbot
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
import asyncio
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
import telethon
 | 
			
		||||
import yaml
 | 
			
		||||
 | 
			
		||||
import pgbotlib.defaults
 | 
			
		||||
import pgbotlib.dbstuff
 | 
			
		||||
import pgbotlib.commands
 | 
			
		||||
import pgbotlib.cron
 | 
			
		||||
| 
						 | 
				
			
			@ -15,9 +15,10 @@ import pgbotlib.response
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def init(args: list) -> tuple:
 | 
			
		||||
    conf_path = args[0] if args else pgbotlib.defaults.CONFIG
 | 
			
		||||
    conf_dir = args[0] if args else '/etc/pgbot'
 | 
			
		||||
    os.chdir(conf_dir)
 | 
			
		||||
    try:
 | 
			
		||||
        with open(conf_path, 'r', encoding='utf-8') as data:
 | 
			
		||||
        with open('pgbot.yml', 'r', encoding='utf-8') as data:
 | 
			
		||||
            config = yaml.safe_load(data.read())
 | 
			
		||||
    except FileNotFoundError as err:
 | 
			
		||||
        sys.exit(err)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue