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?)")
评论列表
文章目录