Using functools partial to pass function instead of return value of function #1
			
				
			
		
		
		
	
							
								
								
									
										5
									
								
								myTS3.py
								
								
								
								
							
							
						
						
									
										5
									
								
								myTS3.py
								
								
								
								
							| 
						 | 
				
			
			@ -12,6 +12,7 @@ __status__ = "Development"
 | 
			
		|||
import os
 | 
			
		||||
import json
 | 
			
		||||
from time import sleep
 | 
			
		||||
from functools import partial
 | 
			
		||||
 | 
			
		||||
# Custom
 | 
			
		||||
import ts3
 | 
			
		||||
| 
						 | 
				
			
			@ -87,10 +88,10 @@ class MyTeamspeakBot:
 | 
			
		|||
 | 
			
		||||
        # Start the timer for auto-updating crypto channels
 | 
			
		||||
        channelname = f"{'[cspacerBTC]Bitcoin:':<33}" + f"{self.gecko.getSymbol('BTC', decimal=0):>5}€"
 | 
			
		||||
        btc_timer = util.maketimer(60, self.editChannelname(200, channelname))
 | 
			
		||||
        btc_timer = util.maketimer(60, partial(self.editChannelname, 200, channelname))
 | 
			
		||||
        btc_timer.start()
 | 
			
		||||
        channelname = f"{'[cspacerETH]Ethereum:':<30}" + f"{self.gecko.getSymbol('ETH', decimal=0):>5}€"
 | 
			
		||||
        eth_timer = util.maketimer(60, self.editChannelname(201, channelname))
 | 
			
		||||
        eth_timer = util.maketimer(60, partial(self.editChannelname, 201, channelname))
 | 
			
		||||
        eth_timer.start()
 | 
			
		||||
 | 
			
		||||
        # Notify connected admins
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue