# If you need this in a bot command @bot.command() async def online(ctx): role = discord.utils.get(bot.get_guild(ctx.guild.id).roles, id ="Role ID") await member.add_roles(role)