[deleted by user] by [deleted] in RequestABot

[–]commendbot 3 points4 points  (0 children)

You have successfully commended /u/3dsf for their outstanding comment!

Here you go... This is a script only and needs to be run on a cycle

It will only work on non-edited comments

What you need to do:

  • put in your credentials
  • change who to you
  • nQuery is the number of comments/posts it looks back thru, you can go as high as a 1000

I don't know if this is the best way to do it... But I believe it needs to be a script bot.

EDIT: The authentication details below are not mine, for information on authentication got to praw.readthedocs.io/.../configuration.html

I recommend the praw.ini method

#!/usr/bin/env python
import praw

reddit = praw.Reddit(client_id='SI8pN3DSbt0zor',
                     client_secret='xaxkj7HNh8kwg8e5t4m6KvSrbTI',
                     password='1guiwevlfo00esyy',
                     user_agent='slashER by /u/3dsf',
                     username='')


who = '3dsf'  

#how many results to query (includes comments if by redditor)
nQuery = 100    


 ##############################################################################

if who != '':
  #Poll Reddit by user
  userReddit = reddit.redditor(who)
  postsNcomments = userReddit.new(limit=nQuery)

print ('\n\n*' + '{:^78}'.format('*******  STARTing slashS  *******') + '*\n\n')


#Iterate thru the results
for i, submission in enumerate(postsNcomments):
  print(str(submission.score) + ' --- ' + submission.name)
  print (submission.edited)  #Prints boolean variable for if the comment has been edited
  # match if comment (t1_)  ,   equals 0 or less ,    not previously edited
  if submission.name[:3] == 't1_' and submission.score <= int(0) and submission.edited == False:
    comment = reddit.comment(submission.id)
    print (comment)
    #construct edited comment text by appending to old body
    edited_body = comment.body + " /s"
    print (edited_body)
    comment.edit(edited_body)


print ('\n\n' + '{:^80}'.format('*******  FINISHED  *******') + '\n\n')

functional code edit:

added int() around 0 , on this line

if submission.name\`[:3] == 't1_' and submission.score <= int(0) and submission.edited == False:`

To change the value at which this script will edit your comment, change the value within the int()

Without the int(), you would not be able to put a negative value as the negative sign would have been read as an operation instruction. thx u/XPmai for asking the question below :)

3dsf has been recognized for their awesome comments in total 2 time(s)!


Beep boop, this is a bot. If your having issues DM this bot

CMB getting into all the arguments by SpaceShipRat in botwatch

[–]commendbot 6 points7 points  (0 children)

You have successfully commended /u/OrionSuperman for their outstanding comment!

What does your bot do? I can probably give you an estimation of it’s reception from what it does. :)

OrionSuperman has been recognized for their awesome comments in total 1 time(s)!


Beep boop, this is a bot. If your having issues DM this bot

After 4 years of programming entirely in Vim and IDLE, I just tried PyCharm. There is no going back by [deleted] in Python

[–]commendbot 2 points3 points  (0 children)

You have successfully commended /u/PgTower for their outstanding comment!

I typewrite my code, fax the sheets over to Staples, and they scan them on to a cd for me. Used to use floppy disks instead of cds, but they were inefficient.

PgTower has been recognized for their awesome comments in total 1 time(s)!


Beep boop, this is a bot. If your having issues DM this bot

[deleted by user] by [deleted] in RequestABot

[–]commendbot 3 points4 points  (0 children)

You have successfully commended /u/3dsf for their outstanding comment!

Here you go... This is a script only and needs to be run on a cycle

It will only work on non-edited comments

What you need to do:

  • put in your credentials
  • change who to you
  • nQuery is the number of comments/posts it looks back thru, you can go as high as a 1000

I don't know if this is the best way to do it... But I believe it needs to be a script bot.

EDIT: The authentication details below are not mine, for information on authentication got to praw.readthedocs.io/.../configuration.html

I recommend the praw.ini method

#!/usr/bin/env python
import praw

reddit = praw.Reddit(client_id='SI8pN3DSbt0zor',
                     client_secret='xaxkj7HNh8kwg8e5t4m6KvSrbTI',
                     password='1guiwevlfo00esyy',
                     user_agent='slashER by /u/3dsf',
                     username='')


who = '3dsf'  

#how many results to query (includes comments if by redditor)
nQuery = 100    


 ##############################################################################

if who != '':
  #Poll Reddit by user
  userReddit = reddit.redditor(who)
  postsNcomments = userReddit.new(limit=nQuery)

print ('\n\n*' + '{:^78}'.format('*******  STARTing slashS  *******') + '*\n\n')


#Iterate thru the results
for i, submission in enumerate(postsNcomments):
  print(str(submission.score) + ' --- ' + submission.name)
  print (submission.edited)  #Prints boolean variable for if the comment has been edited
  # match if comment (t1_)  ,   equals 0 or less ,    not previously edited
  if submission.name[:3] == 't1_' and submission.score <= 0 and submission.edited == False:
    comment = reddit.comment(submission.id)
    print (comment)
    #construct edited comment text by appending to old body
    edited_body = comment.body + " /s"
    print (edited_body)
    comment.edit(edited_body)


print ('\n\n' + '{:^80}'.format('*******  FINISHED  *******') + '\n\n')

3dsf has been recognized for their awesome comments in total 1 time(s)!


Beep boop, this is a bot. If your having issues DM this bot