@rirclear

Как исправить ошибку с выдачей роли в дискорде?

import discord 
from discord import member
from discord.ext import commands 
from discord_components import DiscordComponents, Button, ButtonStyle



bot = commands.Bot(command_prefix=".", intents=discord.Intents.all())


@bot.event 
async def on_ready():
	DiscordComponents(bot)
	print("бот подключен")


@bot.command(pass_context=True)
async def verif(ctx, member: discord.Member = None):
	author = ctx.message.author
	server = ctx.message.guild
	await ctx.send(
		embed=discord.Embed(title="кто вы?"),
		components=[
			Button(style=ButtonStyle.grey, label=" ", custom_id="1", emoji="1️⃣"),
			Button(style=ButtonStyle.grey, label=" ", custom_id="2", emoji="2️⃣"),
			Button(style=ButtonStyle.grey, label=" ", custom_id="3", emoji="3️⃣"),
			Button(style=ButtonStyle.grey, label=" ", custom_id="4", emoji="4️⃣"),
			Button(style=ButtonStyle.grey, label=" ", custom_id="5", emoji="5️⃣")

			

		]	
	)

	responce = await bot.wait_for("button_click")
	if responce.custom_id == "1":
		role = discord.utils.get(ctx.author.guild.roles, id=906979207907778620)
		if not role in ctx.author.roles:
			role = discord.utils.get(ctx.author.guild.roles, id=906979207907778620)
			await member.add_roles(role)

bot.run("token")

619e5983d2262342458809.png
  • Вопрос задан
  • 47 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Telmor
1-е Вы проверяете наличие роли у автора сообщения, а не у мембера.
2-е может быть вы не указываете мембера которому надо выдать(потому что ошибок в коде я не заметил)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы