本文整理匯總了Python中DatabaseManager.DatabaseManager.completeThread方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.completeThread方法的具體用法?Python DatabaseManager.completeThread怎麽用?Python DatabaseManager.completeThread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseManager.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.completeThread方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import completeThread [as 別名]
#.........這裏部分代碼省略.........
try replying to the offer instead.''')
self.db.addCommentToReplied(comment.id)
return
else:
print('''You didn\'t use the accept command and this is
a top level comment, so I don't know who succeed.
try replying to the offer instead.''')
return
# then check if it's an offer
elif '!offer' in str(parent):
# then set the user as the parents author
user = [str(parent.author)]
# we'll also need to make a thread entry
self.db.createThreadEntry(comment.submission.id, user,
str(comment.author), self._parseComment(comment, '!offer'))
else:
if not self.debug:
comment.reply('''An accept was never made, and I can't find
the user that offered. Please try replying,
to the offer or accept the offer and use success
again''')
self.db.addCommentToReplied(comment.id)
return
else:
print('''An accept was never made, and I can't find
the user that offered. Please try replying,
to the offer or accept the offer and use success
again''')
return
# add the finished results
self.db.addFinishedResults(user[0], result)
self.db.completeThread(comment.submission.id)
if not self.debug:
comment.reply(templates.COMPLETED[result].format(user[0]))
self.db.addCommentToReplied(comment.id)
else:
print(templates.COMPLETED[result].format(user[0]))
def _replyWithError(self, comment, err):
'''
replies to comment with corresponding error message
pre: praw comment object, error type
post: the comment is replied to with the error message
'''
if not self.debug:
comment.reply(templates.ERROR[err])
self.db.addCommentToReplied(comment.id)
else:
print(templates.ERROR[err])
def _reportUser(self, comment):
'''
a message is sent to the mods with a user report
pre: praw comment object
post: message is sent to moderators of the sub with a report
'''
body = self._parseComment(comment, '!report')