如何让Praw Script同时观看多个流

时间:2018-12-23 02:39:59

标签: python praw

我有一个redditbot,如果它被发送了消息,或者某个子redditit收到了具有特定标题的帖子,则需要采取措施。我不想在我的计算机的后台同时运行两个不同的python脚本(一个监视bot收件箱,一个监视bot指定为subreddit)。有没有一种方法可以将多个流合并为一个流?

类似的东西:

/* The fs.createWriteStream() returns an (WritableStream {aka} internal.Writeable) and we want the encoding as 'utf'-8 */
/* The WriteableStream has the method write() */
fs.createWriteStream('out.txt', 'utf-8')
.write('hello world');

这是我要合并为一个流的两个代码:

1

for post, msg in reddit.inbox.strea() or subreddit.posts.stream():
     do msg action
     do post action

2

for msg in reddit.inbox.stream(skip_existing = True):
    if msg == 'all':
        all_repots()
    else:
        report(msg)

0 个答案:

没有答案