Answers for "discord.py mention role"

1

add self role with discord bot python

@async def on_message(message):
     if message.content == "give me admin"
           role = discord.utils.get(server.roles, name="Admin")
           await client.add_roles(message.author.id, role)
Posted by: Guest on September-07-2020
2

discord.py mention user

#discord.py rewrite
#python 3+
bot.command(name='pingme', help='pings the author of the message')
async def pingme(ctx):
	#to get a member from a 'ctx' object is ctx.author
	#from there its .mention will mention (ping) the user
	#also there are others like .id
	await ctx.send(ctx.author.mention)
Posted by: Guest on January-19-2021
1

How to create role discord.py

guild = ctx.guild
await guild.create_role(name="role name")
Posted by: Guest on July-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language