SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import discord
  2. from discord.ext import commands
  3. client = discord.Client()
  4. token = open('token.txt').read()
  5. test = 0
  6. green = discord.Color(0x42C08A)
  7. bot = commands.Bot(command_prefix='w!')
  8. @bot.command()
  9. async def collab(ctx):
  10.   global test
  11.   user = ctx.author
  12.   guild = ctx.guild
  13.   for role in guild.roles:
  14.     print(role)
  15.     if role.name == 'Looking to Collab':
  16.       test = role
  17.   if test == 0:
  18.     await guild.create_role(name='Looking to Collab', colour=green, hoist=True)
  19.     await ctx.send('Role created, please run this command again.')
  20.     return
  21.   await user.add_roles(test)
  22.   await ctx.send("Flair changed!")
  23. @bot.command()
  24. async def nocollab(ctx):
  25.   user = ctx.author
  26.   guild = ctx.guild
  27.   for role in guild.roles:
  28.     print(role)
  29.     if role.name == 'Looking to Collab':
  30.       test = role
  31.   try:
  32.     await user.remove_roles(test)
  33.   except:
  34.     await ctx.send("You don't even have that role!")
  35.   await ctx.send("Flair removed!")
  36. bot.run(token)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top