简体   繁体   中英

discord.py bot create an input embed

I want my discord.py bot create an embed after the input of a member. For example {,embed Hello there beauty} and the title is hello there, the description is beauty: just a bit more usefull.D, Like multiple words on each variable, separated by a comma

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))

You have to use !embed "Hello there" beauty and remove the , *, in there cmd args

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM