sutterismine
sutterismine

Reputation: 21

I need help sending embedded messages

I'm trying to make a bot for discord using discord.py that replies to !help with an embedded message. I've seen an answer to this question elsewhere but whenever I run this code python crashes. I've used printing and commenting to determine the problem line is the bottom, where I send the message. Any tips?

        if message.content == ('{}help'.format(prefix)):
            embed = discord.Embed(title="Title", description="Desc", color=0x00ff00)
            embed.add_field(name="Field1", value="hi", inline=True)
            embed.add_field(name="Field2", value="hi2", inline=True)
            print(embed)
            await message.channel.send(embed=embed)

Upvotes: 0

Views: 79

Answers (1)

Katerina
Katerina

Reputation: 174

Have you successfully had the bot send any other messages? When I ran your code in a test bot, it worked just fine. Perhaps your bot doesn't have message-sending privileges in the current channel?

Example bot response

Upvotes: 1

Related Questions