diff --git a/botbotbot/voice.py b/botbotbot/voice.py index 0eebbb6..20ca4b8 100644 --- a/botbotbot/voice.py +++ b/botbotbot/voice.py @@ -42,13 +42,13 @@ class VoiceBot: while True: for g_id in self.guild_ids: guild = self.bot.get_guild(g_id) - if guild is None or random.random() > 10 / 100: + if guild is None: continue logger.info("Random connect.") voice_chan = random.choice(guild.voice_channels) await self.connect_voice(voice_chan) - await asyncio.sleep(60) + await asyncio.sleep(3600 * random.random()) async def connect_voice( self, channel: discord.VoiceChannel | discord.StageChannel @@ -59,8 +59,6 @@ class VoiceBot: logger.info(f"Connecting to voice channel <{channel}>.") if len(channel.members) == 0: vo = await self.connect_voice_chan(channel) - await asyncio.sleep(10) - await vo.disconnect() return elif len(channel.members) == 1: member = self.rnd_name(channel.members[0]) @@ -86,9 +84,8 @@ class VoiceBot: ) source = await discord.FFmpegOpusAudio.from_probe(self.cambai.tts(script)) vo = await self.connect_voice_chan(channel) - + await asyncio.sleep(10 * random.random()) await vo.play(source, wait_finish=True) - await vo.disconnect() @classmethod def rnd_name(cls, user: discord.Member) -> str: