Advertisement
Guest User

Subreddit discord.py command

a guest
Dec 19th, 2020
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. @client.command()
  2. async def COMMANDNAME(ctx):
  3.     sub_submissions = reddit.subreddit('SUBREDDITNAMEHERE').hot()
  4.     post_to_pick = random.randint(1, 20)
  5.     for i in range(0, post_to_pick):
  6.         submission = next(x for x in sub_submissions if not x.stickied)
  7.     e = discord.Embed(title=f'Requested by {ctx.author}', description=f'{submission.title}', color=0xFFFFF)
  8.     e.set_image(url=submission.url)
  9.  
  10.     await ctx.send(embed=e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement