I want to make a bot that makes and assigns a role to the person who requested it. How do I do that? I have tried many things but they all don't work. Here is a copy of the non-functioning code.
import discord
import os
from discord.utils import get
client = discord.Client()
@client.event
async def on_ready():
print ('we have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('~hello?'):
await message.channel.send('YOU WILL NOW WISH YOU NEVER SUMMONED ME...')
client.run(os.environ['TOKEN'])
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == ('~begin?'):
role = get(message.server.roles, name=('Admin'))
await client.add_roles(message.author, role)
client.run(os.environ['TOKEN'])
The first part works (~hello?) but the second part (~begin?) doesn't work. Can one of you gracious souls save me from this endless tussle of debugging and coding?