Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discord.py add role on member join

intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=',', intents=intents)

@client.event 
async def on_member_join(member):
  role = get(member.guild.roles, id=role_id)
  await member.add_roles(role)
Comment

add role discord .py

member = message.author
var = discord.utils.get(message.guild.roles, name = "role name")
member.add_role(var)
Comment

add role discord .py


from discord.ext import commands
from discord.utils import get

bot = commands.Bot(command_prefix='!')

@bot.command(pass_context=True)
@commands.has_role("Admin") # This must be exactly the name of the appropriate role
async def addrole(ctx):
    member = ctx.message.author
    role = get(member.server.roles, name="Test")
    await bot.add_roles(member, role)

Comment

discord add role on member join

@client.event
async def on_member_join(ctx):
    await person.add_roles(person.guild.get_role(<role_id>))
Comment

PREVIOUS NEXT
Code Example
Python :: show image in python 
Python :: create pandas dataframe with random numbers 
Python :: how to open any application using python 
Python :: make y axis start at 0 python 
Python :: array of 1 to 100 python 
Python :: python change working directory to file directory 
Python :: create dict from json file python 
Python :: pandas replace nonetype with empty string 
Python :: python shebang line 
Python :: python error get line 
Python :: rotate x label 90 degrees seaborn 
Python :: plt.plot width line 
Python :: array of random integers python 
Python :: python password generator 
Python :: unlimited arguments python 
Python :: how to install python3 on ubuntu 
Python :: import sklearn linear regression 
Python :: python requests get title 
Python :: how to get specific row in pandas 
Python :: height width image opencv 
Python :: python execute string 
Python :: django created at field 
Python :: how to plot roc curve in python 
Python :: USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) 
Python :: python pi value 
Python :: python diamond print 
Python :: between date pandas 
Python :: qtimer python 
Python :: python radians to degrees 
Python :: python turtle square 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =