KR_SELF 5b6893539b15479caa578ab886fbfe87
이해도 | 초보자 |
---|---|
게임버전 (JE) | 관련없음 |
게임버전 (BE) | 관련없음 |
import discord , os
from discord.ext import commands
from discord.ui import View, Button, Modal, InputText
from discord.ext import commands,tasks
from discord import ui
intents = discord.Intents.all()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
os.system(f"titleBot")
@bot.event
async def on_ready():
print('봇이 준비되었습니다.')
@bot.command()
async def 버튼(ctx):
view = ButtonView()
await ctx.send(view=view)
class ButtonView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label='주민등록', style=discord.ButtonStyle.primary, custom_id='button_1')
async def button_1(self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.send_modal(MODAL(title="등록하기"))
class MODAL(discord.ui.Modal):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.add_item(discord.ui.InputText(label="실명 입력 해주세요."))
async def callback(self, interaction: discord.Interaction):
user = interaction.user.id
nickname = self.children[0].value
role = discord.utils.get(interaction.guild.roles, name='User')
await interaction.user.add_roles(role)
# 디스코드 별명 변경
await interaction.user.edit(nick=nickname)
bot.run('')
Traceback (most recent call last):
File "c:\Users\`\OneDrive\바탕 화면\2\1\discord\ui\modal.py", line 253, in dispatch
await value.callback(interaction)
File "c:\Users\`\OneDrive\바탕 화면\2\1\main.py", line 46, in callback
await interaction.user.edit(nick=nickname)
File "c:\Users\`\OneDrive\바탕 화면\2\1\discord\member.py", line 833, in edit
data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
File "c:\Users\`\OneDrive\바탕 화면\2\1\discord\http.py", line 366, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
단순 봇의 권한 오류인줄 알고 권한이랑 이런거 다 세팅해서 해봤더니 이 오류만 계속뜨네요..
해결법좀 알려주세요
코코냐
2023.12.27역할 순서를 확인해주세요. 모든 관리 권한은 봇보다 냦은 사용자만 관리가 가능합니다.