So, after like an hour of trying I gave up. I was trying to make my embed get edited after 5 seconds but it did not work. I keep getting this error:
”Instance of ‘Embed’ has no ‘message’ member”
JavaScript
x
39
39
1
import discord
2
import random
3
import asyncio
4
import time
5
from discord.ext import commands
6
7
8
class ppsize(commands.Cog):
9
10
def __init__(self, client):
11
self.client = client
12
13
@commands.command(aliases=['mypp', 'sizepp'])
14
async def PPPSize(self, ctx):
15
responses = [ # Or values, however you want to name it
16
'is 2cm.',
17
'is 38cm.',
18
'is 0cm.',
19
'is too small to be measured.',
20
'-16cm.',
21
'bigger than a whole house.',
22
'6cm.',
23
'is 9cm',
24
'is 13cm'
25
]
26
pp = discord.Embed(title="Activating PP Size Measurement...!", description="Loading PP Size...")
27
pp.set_image(url="https://tul.imgix.net/content/article/banana.jpg?auto=format,compress&w=1200&h=630&fit=crop")
28
pp2 = discord.Embed(title="PP Size Measurement Has Been Activated!", description=random.choice(responses))
29
pp2.set_image(url="https://tul.imgix.net/content/article/banana.jpg?auto=format,compress&w=1200&h=630&fit=crop")
30
31
await ctx.send(embed=pp)
32
await asyncio.sleep(5)
33
await pp.message.edit(embed=pp2)
34
35
36
37
def setup(client):
38
client.add_cog(ppsize(client))
39
Pretty basic command but no clue what to do. Also do I need the ‘Import time’?
Advertisement
Answer
You’re trying to edit the embed instead of the actual posted message.
JavaScript
1
2
1
await pp.message.edit(embed=pp2)
2
is referring to the embed. That embed doesn’t have an attribute called ‘message’, hence the error.
To fix this:
JavaScript
1
4
1
message = await ctx.send(embed=pp)
2
await asyncio.sleep(5)
3
await message.edit(embed=pp2)
4