Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- client = discord.Client()
- token = open('token.txt').read()
- test = 0
- green = discord.Color(0x42C08A)
- bot = commands.Bot(command_prefix='w!')
- @bot.command()
- async def collab(ctx):
- global test
- user = ctx.author
- guild = ctx.guild
- for role in guild.roles:
- print(role)
- if role.name == 'Looking to Collab':
- test = role
- if test == 0:
- await guild.create_role(name='Looking to Collab', colour=green, hoist=True)
- await ctx.send('Role created, please run this command again.')
- return
- await user.add_roles(test)
- await ctx.send("Flair changed!")
- @bot.command()
- async def nocollab(ctx):
- user = ctx.author
- guild = ctx.guild
- for role in guild.roles:
- print(role)
- if role.name == 'Looking to Collab':
- test = role
- try:
- await user.remove_roles(test)
- except:
- await ctx.send("You don't even have that role!")
- await ctx.send("Flair removed!")
- bot.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement