discord.py bot 创建一个输入嵌入

时间:2021-01-03 21:27:25

标签: python discord.py

我希望我的 discord.py bot 在成员输入后创建一个嵌入。例如 {!embed Hello there beautiful} 标题是你好,描述是美,只是更有用一点:D。就像每个变量上的多个单词,用逗号分隔

import discord
from discord.ext import commands


class drops(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    @commands.has_any_role(795263101309681690, 795263101309681688, 779491292627468308)
    async def embed(self, ctx, *,dropalert, start, social, location, write): #don't mind the dropalert, take it as a title
        dropEmbed = discord.Embed(title = dropalert, colour = 0xFF0000)
        dropEmbed.add_field(name='Drop starts:', value = start)
        dropEmbed.add_field(name="Social club:", value = social)
        dropEmbed.add_field(name = "Location:", value = location)
        dropEmbed.set_footer(text = write)

        await ctx.send(embed=dropEmbed)

def setup(bot):
    bot.add_cog(drops(bot))

1 个答案:

答案 0 :(得分:3)

您必须使用 !embed "Hello there" beauty 并删除那里的 cmd args 中的 , *,