capture discord module output
This commit is contained in:
		
							parent
							
								
									4ce3af150c
								
							
						
					
					
						commit
						9870ce5aa6
					
				
					 2 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -300,10 +300,11 @@ fn get(config_path: String) -> Result<(), &'static str> {
 | 
			
		|||
            let _ = remove_file(&config.pfp_module.pfp_output_path);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Command::new("sh").arg("-c").arg(format!("cp {}/{} {}", &config.pfp_module.pfp_folder, pfpnames, &config.pfp_module.pfp_output_path)).output().expect("pfp module error");
 | 
			
		||||
        Command::new("sh").arg("-c").arg(format!("cp {}/{} {}", &config.pfp_module.pfp_folder, pfpnames, &config.pfp_module.pfp_output_path)).output().expect("PFP module error");
 | 
			
		||||
 | 
			
		||||
        if config.disc_module.enabled {
 | 
			
		||||
            Command::new("sh").arg("-c").arg(format!("{} {}", &config.disc_module.python_path, &config.disc_module.script_path)).output().expect("discord module error");
 | 
			
		||||
            let mut c = Command::new("sh").arg("-c").arg(format!("{} {}", &config.disc_module.python_path, &config.disc_module.script_path)).spawn().expect("Discord module error");
 | 
			
		||||
            let _ = c.wait().expect("Error");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,7 @@ class MyClient(discord.Client):
 | 
			
		|||
        fp = open(pfp_path, 'rb')
 | 
			
		||||
        pfp = fp.read()
 | 
			
		||||
        await self.user.edit(avatar=pfp)
 | 
			
		||||
        print('Discord module finished')
 | 
			
		||||
        await self.close()
 | 
			
		||||
 | 
			
		||||
client = MyClient()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue