Skip to content

TypeScript code snippet – How to discord bot events random pictures?

import discord
from discord.ext import commands
import aiohttp

client = commands.Bot(command_prefix="!")

async def on_ready():

async def dog(ctx):
   async with aiohttp.ClientSession() as session:
      request = await session.get('') # Make a request
      dogjson = await request.json() # Convert it to a JSON dictionary
   embed = discord.Embed(title="Doggo!", color=discord.Color.purple()) # Create embed
   embed.set_image(url=dogjson['link']) # Set the embed image to the value of the 'link' key
   await ctx.send(embed=embed) # Send the embed'token')
See also  PHP code snippet - wp How to call parent category template?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.