Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Meme API
#1
Hello

I'm a beginning student who started programming.
For school we need to work with 2 api's. I'm using Discord and meme-api.herokuapp.
I am able to post a meme into Discord, now I'm looking to add a choice for a subreddit and a count.
The reddit and count needs to be asked in discord or needs to be defined in the command (posted in discord)
Is there any person who would be available to help?
Documentation: https://github.com/D3vd/Meme_Api
code:
import json
import discord
from discord.ext import commands
import urllib

client = commands.Bot(command_prefix='!', help_command=None, intents=discord.Intents.all())

async def on_ready():
    print('Server Running')


@client.command()
async def meme(ctx):
    memeAPI = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')

    memeData = json.load(memeAPI)
    
    memeUrl = memeData['url']
    memeName = memeData['title']
    
    embed = discord.Embed(title=memeName, colour=discord.Colour.orange())
    embed.set_image(url=memeUrl)
    await ctx.send(embed=embed)

@client.command()
async def pring(ctx):
    await ctx.reply("Pong")

#BOT TOKEN
client.run(######DISCORD BOT CODE)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020