목록on_message (2)
변명은 만개 결과는 한개
결론은 포스트 최하단에 있습니다 :) 서론 처음에 디스코드 python 봇 코드를 본 뒤 조금 만지작 거리다 의아했던점은 @bot.command() 와 @bot.event 의 on_message 이벤트는 같이 쓰지 못하는걸까? 였다. 그도 그럴것이, 1 2 3 4 5 6 7 8 9 @bot.command() async def ABC(ctx): print("ABC 커맨드 호출 :)") pass @bot.event async def on_message(message): print("on_message 이벤트 호출 :)") pass cs 일때, ABC 커맨드는 호출되지 않고 on_message 이벤트만 호출되었기 때문이다. 아니면, @bot.command() 와 @bot.event 가 양립하지 못하는건가? ㅎ..
import discord client = discord.Client() token = "YOUR_BOT_TOKEN" @client.event async def on_ready(): print("logged in as ") #화면에 봇의 아이디, 닉네임 출력 print(client.user.name) print(client.user.id) print("==============") # 디스코드에는 현재 본인이 어떤 게임을 플레이하는지 보여주는 기능이 있습니다. # 이 기능을 이용하여 봇의 상태를 간단하게 출력 가능합니다. game = discord.Game("with the API") await client.change_presence(status=discord.Status.idle, activity=g..