[Discord Bot] HelloBot 만들기
새로운 프로젝트로 Discord에 Bot을 만들어보기로 합니다.
디스코드 봇 생성하기
https://discord.com/developers/applications
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
discord.com
위 링크에 들어가서 새로운 애플리케이션을 생성합니다.

이름 작성하고, 디스코드 개발자 서비스 약관 및 정책에 동의합니다.
Create 생성 클릭

기본적으로 General Information을 보여줄텐데 자유롭게 꾸며보시면 되고요,
상단 왼쪽에 햄버거 메뉴 클릭합니다.

TOKEN 생성 또는 Reset 해주시고, Copy 해서 메모장 같은 곳에 붙여둡니다.
봇 개발 할 때 사용해야 하기 때문이죠.

import discord
discord_token = '{Token을 입력하세요}'
client = discord.Client(intents=discord.Intents.all())
@client.event
async def on_ready():
print('We have logged in as {}'.format(client))
print('Bot name: {}'.format(client.user.name))
print('Bot ID: {}'.format(client.user.id))
@client.event
async def on_message(message):
print(message.content)
if message.author == client.user:
return
elif message.content.startswith('hello'):
await message.channel.send('Hello!')
client.run(discord_token)
# 실행결과

도대체 이 메세지를 왜 읽어오지 못하는 걸까요 ??? ...
내가 뭘 잘못했는데
discord.content empty // ... 검색해도 나오지 않습니다.
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal
에러가 길어서 무슨 말인지 모르겠다고 생각했는데,
잘 읽어보니 developer portal에서 승인이 되어있지 않다 이런 말인 것 같습니다.
다시 discord developer portal에 > Bot 중간쯤에 Privileged Gateway Intents > MESSAGE CONTENT INTENT
활성화 해주었습니다.

드디어 답변을 준 이녀석...
