Skip to content

Instantly share code, notes, and snippets.

@aikocc
Created June 13, 2020 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aikocc/a1c149e9e72804bbff47a6e197b28309 to your computer and use it in GitHub Desktop.
Save aikocc/a1c149e9e72804bbff47a6e197b28309 to your computer and use it in GitHub Desktop.
Give roles on going Live on twitch
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='?')
@bot.event
async def on_member_update(before, after):
streaming_role = after.guild.get_role(<replace this>)
if after.activity is discord.Streaming:
if not streaming_role in after.roles:
await after.add_roles(streaming_role)
elif after.activity is not discord.Streaming:
if streaming_role in after.roles:
await after.remove_roles(streaming_role)
bot.run('token')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment