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 os | ||||||
| import json | import json | ||||||
| from time import sleep | from time import sleep | ||||||
|  | from functools import partial | ||||||
| 
 | 
 | ||||||
| # Custom | # Custom | ||||||
| import ts3 | import ts3 | ||||||
|  | @ -87,10 +88,10 @@ class MyTeamspeakBot: | ||||||
| 
 | 
 | ||||||
|         # Start the timer for auto-updating crypto channels |         # Start the timer for auto-updating crypto channels | ||||||
|         channelname = f"{'[cspacerBTC]Bitcoin:':<33}" + f"{self.gecko.getSymbol('BTC', decimal=0):>5}€" |         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() |         btc_timer.start() | ||||||
|         channelname = f"{'[cspacerETH]Ethereum:':<30}" + f"{self.gecko.getSymbol('ETH', decimal=0):>5}€" |         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() |         eth_timer.start() | ||||||
| 
 | 
 | ||||||
|         # Notify connected admins |         # Notify connected admins | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue