base.py 文件源码

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

项目:Asurix-bot 作者: Beafantles 项目源码 文件源码
def set_stream(self, stream_link: str = "", *game):
        """Sets bot's stream name
        Parameters:
            stream_link: the link to the stream you want to set for the bot
            *game:  The game you want to set for the bot's stream
                    Leaving this blank will remove bot's stream status

        Example: [p]set_stream https://www.twitch.tv/beafantles coding myself!"""
        try:
            if stream_link != "":
                if stream_link.startswith("https://www.twitch.tv/"):
                    await self.bot.change_presence(game=discord.Game(\
                        name=" ".join(game), type=1, url = stream_link))
                    await self.bot.say("Done! :ok_hand:")
                else:
                    await self.bot.say("Please provide a correct stream link")
            else:
                await self.bot.change_presence(game=None)
                await self.bot.say("Done! :ok_hand:")
        except discord.InvalidArgument:
            await self.bot.say("Wrong game name format (too long?)")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号