![]() |
Meme API - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Meme API (/thread-38835.html) |
Meme API - Rikkert - Nov-29-2022 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) |