Funstuff.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Luna 作者: Moonlington 项目源码 文件源码
def poll(self, ctx, *, string: str):
        """Formatting: Question|Option 1|Option 2|etc."""
        await self.bot.delete_message(ctx.message)
        string = string.strip("| *")
        split = string.split("|")
        emojibet = ['??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??', '??']
        alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
        question = split[0].strip(" ")
        query = [x.strip(" ") for x in split[1:] if x.strip(" ") != ""]
        em = discord.Embed(description=question, colour=ctx.message.author.color)
        for i, q in enumerate(query):
            em.add_field(name = "Option " + alphabet[i], value = q, inline = False)
        em.set_author(name=ctx.message.author.display_name, icon_url=ctx.message.author.avatar_url)
        em.set_footer(text="React to this message to vote! (Sorry mobile users)")
        sent = await self.bot.send_message(ctx.message.channel, embed = em)
        for i, _ in enumerate(query):
            await self.bot.add_reaction(sent, emojibet[i])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号