I was using Discord.py, but when I tried to have the bot display embed using the code below, it didn't show up.Where should I correct it?
import discord
client=discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author==client.user:
return
if message.content.startswith('$test'):
wait message.channel.send(embed))
embedded=embedobj
embedded=discord.Embed(title="Bot Help List", colour=discord.Colour(0x112f43), url="https://discordapp.com", description="``Prefix:$``", timestamp=datetime.utcfromtimestamp(1551172370))
embedded.set_image()
embedded.set_thumbnail(url="http://3.bp.blogspot.com/-k74QBLjNuyg/TtiCcfDf2pI/AAAAAAAAAGw/coMwMiItguo/s1600/Mameshiba-Edamame-Wallpaper.jpg")
embedded.set_author(name="eDaMAme#1597", url="https://discordapp.com", icon_url="https://bit.ly/2SsIBiC")
embedded.set_footer(text="footer text", icon_url="https://cdn.discordapp.com/embed/avatars/0.png")
embedded.add_field(name="$hello", value="Say hello")
embedded.add_field(name="$weather", value="weather information")
embedded.add_field(name="$zisin", value="earthquake information")
embedded.add_field(name="$happy,$sad,$angry", value="emoji display", inline=True)
embedded.add_field(name="Various others", value="Will be added", inline=True)
wait bot.say(embed=embed)
client.run('token')
It's the async version.There's a huge update coming up soon, so you'd better switch to the new version of Rewrite as soon as possible.
Let's get down to business, but I'm concerned about embed=embedobj
.Embedobj seems to be undefined.I don't think you need this line.
Also, embed.set_image()
requires arguments.If you don't want to add an image, you don't need that line.
There are no errors, right?
if message.author==client.user:
Isn't this the problem?
if message.author==client.user:
return
This means that the message is repelled by the user.
If you want to hear what BOT said,
if message.author.bot:
return
Let's rewrite it like this.
import discord
embedded=discord.Embed(title="Bot Help List", colour=discord.Colour(0x112f43), url="https://discordapp.com", description="``Prefix:$``", timestamp=datetime.utcfromtimestamp(1551172370))
embedded.set_thumbnail(url="http://3.bp.blogspot.com/-k74QBLjNuyg/TtiCcfDf2pI/AAAAAAAAAGw/coMwMiItguo/s1600/Mameshiba-Edamame-Wallpaper.jpg")
embedded.set_author(name="eDaMAme#1597", url="https://discordapp.com", icon_url="https://bit.ly/2SsIBiC")
embedded.set_footer(text="footer text", icon_url="https://cdn.discordapp.com/embed/avatars/0.png")
embedded.add_field(name="$hello", value="Say hello")
embedded.add_field(name="$weather", value="weather information")
embedded.add_field(name="$zisin", value="earthquake information")
embedded.add_field(name="$happy,$sad,$angry", value="emoji display", inline=True)
embedded.add_field(name="Various others", value="Will be added", inline=True)
client=discord.Client(ints=discord.Intents.all())
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author==client.user:
return
if message.content.startswith('$test'):
wait message.channel.send(embed=embed)
client.run('token')
581 PHP ssh2_scp_send fails to send files as intended
578 Understanding How to Configure Google API Key
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
911 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.