Implementation for setting max volume (#336)

* Added support for creating a max volume

* Fixed db function calls

* Fixed issue with max volume always adjusting volume
This commit is contained in:
Caleb Leinz (he/him)
2022-07-12 09:13:10 -07:00
committed by GitHub
parent 0650e7279f
commit a50a067641
5 changed files with 42 additions and 6 deletions

View File

@ -137,9 +137,13 @@ class MumbleBot:
# ====== Volume ======
self.volume_helper = util.VolumeHelper()
max_vol = var.config.getfloat('bot', 'max_volume')
if var.db.has_option('bot', 'max_volume'):
max_vol = var.db.getfloat('bot', 'max_volume')
_volume = var.config.getfloat('bot', 'volume')
if var.db.has_option('bot', 'volume'):
_volume = var.db.getfloat('bot', 'volume')
_volume = min(_volume, max_vol)
self.volume_helper.set_volume(_volume)
self.is_ducking = False