편집 기록

편집 기록
  • 프로필 편집요청빌런님의 편집
    날짜2020.05.04

    python으로 discord bot 만드는 중 타입 에러


    python으로 디스코드 봇을 만들고 있던 도중 투표기능을 만들고 있었습니다.

    #투표
        if message.content.startswith("!투표"):
            vote = message.content[4:].split(" / ")
            await message.channel.send("★투표 - " + vote[0])
            for i in range(1, len(vote)):
                choose = await message.channel.send("```" + vote[i] + "```")
                await message.add_reaction(choose, ('👍'))
    

    이렇게 했는데 TypeError: add_reaction() takes 2 positional arguments but 3 were given 라며 오류가 뜹니다 검색해봐도 잘 모르겠어서 여기에 질문 남깁니다. 어떻게 해야합니까?

    전체 코드는

    import discord
    import asyncio
    import random
    
    client = discord.Client()
    
    #준비 확인
    @client.event
    async def on_ready():
        print(client.user.id)
        print(client.user.name)
        print("ready")
        game = discord.Game("!명령어")
        await client.change_presence(status=discord.Status.online, activity=game)
    
    
    @client.event
    async def on_message(message):
        #투표
        if message.content.startswith("!투표"):
            vote = message.content[4:].split(" / ")
            await message.channel.send("★투표 - " + vote[0])
            for i in range(1, len(vote)):
                choose = await message.channel.send("```" + vote[i] + "```")
                await message.add_reaction(choose, ('👍'))
    
    
    
    client.run("토큰")
    

    입니다.

  • 프로필 nowp님의 편집
    날짜2020.04.06

    python으로 discord bot 만들던 중 오류: TypeError: add_reaction() takes 2 positional arguments but 3 were given


    python으로 디스코드 봇을 만들고 있던 도중 투표기능을 만들고 있었습니다.

    #투표
        if message.content.startswith("!투표"):
            vote = message.content[4:].split(" / ")
            await message.channel.send("★투표 - " + vote[0])
            for i in range(1, len(vote)):
                choose = await message.channel.send("```" + vote[i] + "```")
                await message.add_reaction(choose, ('👍'))
    

    이렇게 했는데 TypeError: add_reaction() takes 2 positional arguments but 3 were given 라며 오류가 뜹니다 검색해봐도 잘 모르겠어서 여기에 질문 남깁니다. 어떻게 해야합니까?

    전체 코드는

    import discord
    import asyncio
    import random
    
    client = discord.Client()
    
    #준비 확인
    @client.event
    async def on_ready():
        print(client.user.id)
        print(client.user.name)
        print("ready")
        game = discord.Game("!명령어")
        await client.change_presence(status=discord.Status.online, activity=game)
    
    
    @client.event
    async def on_message(message):
        #투표
        if message.content.startswith("!투표"):
            vote = message.content[4:].split(" / ")
            await message.channel.send("★투표 - " + vote[0])
            for i in range(1, len(vote)):
                choose = await message.channel.send("```" + vote[i] + "```")
                await message.add_reaction(choose, ('👍'))
    
    
    
    
    client.run("토큰")
    

    입니다.

  • 프로필 이준호님의 편집
    날짜2020.04.06

    초보라 잘 모르겠습니다. python으로 discord bot 만들고 있던 도중 뭐가 잘못된지 모르겠습니다.


    python으로 디스코드 봇을 만들고 있던 도중 투표기능을 만들고 있었습니다.

    #투표
        if message.content.startswith("!투표"):
            vote = message.content[4:].split(" / ")
            await message.channel.send("★투표 - " + vote[0])
            for i in range(1, len(vote)):
                choose = await message.channel.send("```" + vote[i] + "```")
                await message.add_reaction(choose, ('👍'))
    

    이렇게 했는데 TypeError: add_reaction() takes 2 positional arguments but 3 were given 라며 오류가 뜹니다 검색해봐도 잘 모르겠어서 여기에 질문 남깁니다. 어떻게 해야합니까?

    전체 코드는

    import discord
    import asyncio
    import random
    
    client = discord.Client()
    
    #준비 확인
    @client.event
    async def on_ready():
        print(client.user.id)
        print(client.user.name)
        print("ready")
        game = discord.Game("!명령어")
        await client.change_presence(status=discord.Status.online, activity=game)
    
    
    @client.event
    async def on_message(message):
        #투표
        if message.content.startswith("!투표"):
            vote = message.content[4:].split(" / ")
            await message.channel.send("★투표 - " + vote[0])
            for i in range(1, len(vote)):
                choose = await message.channel.send("```" + vote[i] + "```")
                await message.add_reaction(choose, ('👍'))
    
    
    
    
    client.run("토큰")
    

    입니다.