sfx.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:FlapJack-Cogs 作者: flapjax 项目源码 文件源码
def enqueue_tts(self, vchan: discord.Channel,
                           text: str,
                            vol: int=None,
                       priority: int=5,
                          tchan: discord.Channel=None,
                       language: str=None):
        if vol is None:
            vol = self.tts_volume
        if language is None:
            language = self.language
        tts = gTTS(text=text, lang=language)
        path = self.temp_filepath + ''.join(random.choice(
                   '0123456789ABCDEF') for i in range(12)) + ".mp3"
        tts.save(path)

        try:
            item = {'cid': vchan.id, 'path': path, 'vol': vol,
                    'priority': priority, 'delete': True, 'tchan': tchan}
            self.master_queue.put_nowait(item)
            return True
        except asyncio.QueueFull:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号