📜  bot delete embed py - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:48.690000             🧑  作者: Mango

代码示例1
@commands.command(name='hug', pass_context=True, aliases=['hugs'])
    @commands.cooldown(5, 60, commands.BucketType.user)
    async def hug(self, context, member: discord.Member):
        """Hug your friend"""
        author = context.message.author.mention
        mention = member.mention

        hug = "{0} hugs {1}"

        choices = ['example.gif']

        image = random.choice(choices)

        embed = discord.Embed(description=hug.format(author, mention), colour=discord.Color(random.randint(0x000000, 0xFFFFFF)))
        embed.set_image(url=image)

        await self.bot.say(embed=embed)
        await asyncio.sleep(3) 
        await self.bot.delete_message(embed)