sounds.py 文件源码

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

项目:GeBeO 作者: professional-programmingers 项目源码 文件源码
def add_sound(self, ctx, source, sourcetype):
        """ Add a sound to a bot's queue. """
        if ctx.message.author.voice == None:
            await ctx.send("You're not in a voice channel!")
        else:
            # Check if any bots in guild. Warn user if not.
            # TODO: Move to Bot Manager.
            for helper in self.bot.helperList:
                if helper.is_in_guild(ctx.guild):
                    break
            else:
                await ctx.send("No helper bots in this server. Do !invite to add them.")
                return

            vchan_id = ctx.message.author.voice.channel.id
            sound = await self.parse_sound(source, sourcetype)

            # Find a bot and add to its queue.
            helper = self.choose_helper(vchan_id)
            if helper != None:
                await helper.queue_sound(vchan_id, sound)
                await ctx.send("Queueing sound!")
            else:
                await ctx.send("Sorry, there are no available bots!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号