Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import asyncio
- import praw
- import time
- from discord.ext import commands
- reddit = praw.Reddit(client_id='dJCf1KddZkYxGA',
- client_secret='6O7rBxqGDMnrkwXfDuLpeLsPRqI',
- user_agent='pc:com.example.reddittronforprivate:v1.0.0 (by /u/yukineismybae)',
- username='yukineismybae',
- password='Pokemon999')
- client = discord.Client()
- chosenSub = 'me_irl'
- upvoteAmount = 1000
- checkCycle = 25
- @client.event
- async def on_ready():
- channel = discord.Object(id=230371186020712459)
- subreddit = reddit.subreddit(chosenSub)
- while not client.is_closed:
- for submission in subreddit.hot(limit=checkCycle):
- if submission.ups >= upvoteAmount:
- if ((submission.url) in open('posts.txt').read()) == False:
- posts = open("posts.txt","a")
- posts.write(submission.url+"\n")
- posts.close()
- await client.send_message(channel, submission.url)
- time.sleep(10)
- @client.event
- async def on_message(message):
- if message.content.startswith('!choosesub'):
- await client.send_message(message.channel, 'Reply to me with the name of the sub you choose')
- chosenSub = await client.wait_for_message(author=message.author)
- await client.send_message(message.channel, 'Thank you', chosenSub, 'has been chosen')
- elif message.content.startswith('!chooseup'):
- await client.send_message(message.channel, 'Reply to me with the amount of upvotes a post needs for me to send it here')
- upvoteAmount = client.wait_for_message(author=message.author)
- await client.send_message(message.channel, 'Thank you', upvoteAmount, 'upvotes has been chosen')
- elif message.contant.startswith('!howmany'):
- await client.send_message(message.channel, 'Reply to me with how many posts I should check from the subreddit each cycle')
- checkCycle = client.wait_for_message(authout=message.author)
- await client.send_message(message.channel, 'Thank you', checkCycle, 'has been chosen')
- client.run("MzUyMTQwMTUwMzc1MDU1MzYy.DIiUkw.vHmK8u1LZxx4sq5YFWs7tNj4-8w")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement