diff --git a/botbotbot/voice.py b/botbotbot/voice.py index 6cad996..e234108 100644 --- a/botbotbot/voice.py +++ b/botbotbot/voice.py @@ -58,13 +58,12 @@ class VoiceBot: activity = discord.CustomActivity(status) await self.bot.change_presence(activity=activity) - if random.random() < 50 / 100: + weights = [10 * len(vc.members) + 1 for vc in guild.voice_channels] + if random.random() < sum(weights) / 100: logger.info("Random connect.") voice_chan = random.choices( guild.voice_channels, - weights=[ - 10 * len(vc.members) + 1 for vc in guild.voice_channels - ], + weights=weights, )[0] await self.connect_voice(voice_chan) if not voice_chan.status and self.aibot is not None: