如何使用Discord机器人计算帖子的反应

时间:2018-09-08 19:16:05

标签: python-3.x discord.py

这是我的代码:

import discord
import asyncio

channel = None

async def ex(args, message, client, invoke):

    global channel
    channel = message.channel
    one = ""
    two = ""
    three = ""

    one_count = 0
    two_count = 0
    three_count = 0

    vote = discord.Embed(title="**[POLL]**", description=" ", color=0x00ff00)
    vote.add_field(name="Please vote for the match type:", value="- "+one+" Solos\n- "+two+" Duos\n- "+three+" Squads", inline=True)
    message_1 = await client.send_message(channel, embed=vote)

    await client.add_reaction(message_1, one)
    await client.add_reaction(message_1, two)
    await client.add_reaction(message_1, three)

关于我如何让它在短暂的等待期后计算反应量的任何想法?

谢谢

1 个答案:

答案 0 :(得分:0)

使用import numpy as np csv_file=pd.read_csv('file.csv',names = ['USER', 'CLIENT', 'TYPE', 'START', 'END', 'DURATION', 'NOTES', 'DATE'],parse_dates=['DATE']) csv_file.pivot_table('DURATION',index='DATE',columns='CLIENT',aggfunc=np.sum) 等待投票结束,然后您可以获取所有反应的计数并以此来确定获胜者

asyncio.await