【发布时间】:2021-04-20 22:24:47
【问题描述】:
所以,经过大约一个小时的尝试,我放弃了。我试图让我的嵌入在 5 秒后得到编辑,但它不起作用。我不断收到此错误:
'''Embed'实例没有'message'成员''
import discord
import random
import asyncio
import time
from discord.ext import commands
class ppsize(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(aliases=['mypp', 'sizepp'])
async def PPPSize(self, ctx):
responses = [ # Or values, however you want to name it
'is 2cm.',
'is 38cm.',
'is 0cm.',
'is too small to be measured.',
'-16cm.',
'bigger than a whole house.',
'6cm.',
'is 9cm',
'is 13cm'
]
pp = discord.Embed(title="Activating PP Size Measurement...!", description="Loading PP Size...")
pp.set_image(url="https://tul.imgix.net/content/article/banana.jpg?auto=format,compress&w=1200&h=630&fit=crop")
pp2 = discord.Embed(title="PP Size Measurement Has Been Activated!", description=random.choice(responses))
pp2.set_image(url="https://tul.imgix.net/content/article/banana.jpg?auto=format,compress&w=1200&h=630&fit=crop")
await ctx.send(embed=pp)
await asyncio.sleep(5)
await pp.message.edit(embed=pp2)
def setup(client):
client.add_cog(ppsize(client))
相当基本的命令,但不知道该怎么做。我还需要“导入时间”吗?
【问题讨论】:
标签: python python-3.x discord discord.py discord.py-rewrite