Merge pull request #309 from knector01/master
Allow changing bot avatar
This commit is contained in:
		@@ -29,6 +29,7 @@ certificate =
 | 
				
			|||||||
[bot]
 | 
					[bot]
 | 
				
			||||||
username = botamusique
 | 
					username = botamusique
 | 
				
			||||||
comment = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!"
 | 
					comment = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!"
 | 
				
			||||||
 | 
					avatar =
 | 
				
			||||||
# default volume from 0 to 1.
 | 
					# default volume from 0 to 1.
 | 
				
			||||||
volume = 0.1
 | 
					volume = 0.1
 | 
				
			||||||
stereo = True
 | 
					stereo = True
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,8 +21,10 @@ port = 64738
 | 
				
			|||||||
[bot]
 | 
					[bot]
 | 
				
			||||||
# 'username' is the user name of the bot.
 | 
					# 'username' is the user name of the bot.
 | 
				
			||||||
# 'comment' is the comment displayed by the bot.
 | 
					# 'comment' is the comment displayed by the bot.
 | 
				
			||||||
 | 
					# 'avatar' is the path to the avatar image shown on the bot (PNG recommended, 128 KB max).
 | 
				
			||||||
#username = botamusique
 | 
					#username = botamusique
 | 
				
			||||||
#comment = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!"
 | 
					#comment = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!"
 | 
				
			||||||
 | 
					#avatar =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 'language': Available languages can be found inside lang/ folder.
 | 
					# 'language': Available languages can be found inside lang/ folder.
 | 
				
			||||||
#language=en_US
 | 
					#language=en_US
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								mumbleBot.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								mumbleBot.py
									
									
									
									
									
								
							@@ -127,6 +127,7 @@ class MumbleBot:
 | 
				
			|||||||
            exit()
 | 
					            exit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.set_comment()
 | 
					        self.set_comment()
 | 
				
			||||||
 | 
					        self.set_avatar()
 | 
				
			||||||
        self.mumble.users.myself.unmute()  # by sure the user is not muted
 | 
					        self.mumble.users.myself.unmute()  # by sure the user is not muted
 | 
				
			||||||
        self.join_channel()
 | 
					        self.join_channel()
 | 
				
			||||||
        self.mumble.set_bandwidth(self.bandwidth)
 | 
					        self.mumble.set_bandwidth(self.bandwidth)
 | 
				
			||||||
@@ -233,6 +234,15 @@ class MumbleBot:
 | 
				
			|||||||
    def set_comment(self):
 | 
					    def set_comment(self):
 | 
				
			||||||
        self.mumble.users.myself.comment(var.config.get('bot', 'comment'))
 | 
					        self.mumble.users.myself.comment(var.config.get('bot', 'comment'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def set_avatar(self):
 | 
				
			||||||
 | 
					        avatar_path = var.config.get('bot', 'avatar', fallback=None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if avatar_path:
 | 
				
			||||||
 | 
					            with open(avatar_path, 'rb') as avatar_file:
 | 
				
			||||||
 | 
					                self.mumble.users.myself.texture(avatar_file.read())
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self.mumble.users.myself.texture(b'')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def join_channel(self):
 | 
					    def join_channel(self):
 | 
				
			||||||
        if self.channel:
 | 
					        if self.channel:
 | 
				
			||||||
            if '/' in self.channel:
 | 
					            if '/' in self.channel:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user