how to send a message with a python bot discord code example
Example 1: send message to discord wrbhook python
from discord_webhook import DiscordWebhook, DiscordEmbed
webhook = DiscordWebhook(url='your webhook url', username="New Webhook Username")
embed = DiscordEmbed(title='Embed Title', description='Your Embed Description', color='03b2f8')
embed.set_author(name='Author Name', url='https://github.com/lovvskillz', icon_url='https://avatars0.githubusercontent.com/u/14542790')
embed.set_footer(text='Embed Footer Text')
embed.set_timestamp()
embed.add_embed_field(name='Field 1', value='Lorem ipsum')
embed.add_embed_field(name='Field 2', value='dolor sit')
embed.add_embed_field(name='Field 3', value='amet consetetur')
embed.add_embed_field(name='Field 4', value='sadipscing elitr')
webhook.add_embed(embed)
response = webhook.execute()
Example 2: how to make a discord bot send a message python
import discord
from discord.ext import commands
client = commands.Bot(command_prefix='!!')
TOKEN = 'insert token here'
@client.event
def on_ready():
print('Ready. Logged in as: {0.user}'.format(client))
@client.command(brief='Echoes back what user says.')
async def echo(ctx, *, user_message):
await ctx.send('User said --> ' + user_message)
client.run(TOKEN)