社区自动屏蔽帖子和用户小程序

社区自动屏蔽帖子和用户小程序

自从某大佬在CN社区点赞后,出现了很多外来水军

由于外来水军的账号很多,就算是加了多名管理员来处理账号和帖子,一个个帖子和账号屏蔽很费时间。而且水军账号被屏蔽后会不断注册新号发帖

所以写了一个小程序自动屏蔽那些在CN社区发帖的新账号

程序代理如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const steem = require('steem');
const account = 'STEEM ID';
const wif = 'POSTING KEY';

start()


function start() {
steem.api.streamTransactions('head', async function (err, result) {
let txType = result.operations[0][0]
let txData = result.operations[0][1]
if (txType === 'comment') {
if (txData.parent_author === '' && txData.parent_permlink === 'hive-180932') {
let rep = await getAccountReputation(txData.author);
if (rep <= 25) {
console.log(`${txData.author}:${rep}`)
mutePost(txData.author, txData.permlink);
muteUser(txData.user);
}
}
}
});
}

function getAccountReputation(user) {
return new Promise((resolve) => {
steem.api.getAccounts([user], (err, result) => {
if (!err && result[0]) {
resolve(steem.formatter.reputation(result[0].reputation));
} else {
resolve(null);
}
});
});

}

function muteUser(user) {
let json = JSON.stringify(
['setRole',
{
community: 'hive-180932',
account: user,
role: 'muted'
}
]);
steem.broadcast.customJson(wif, [], [account], 'community', json, (err, result) => {
if (err)
console.log(err);
else {
console.log('success');
}

});
}


function mutePost(user, permlink) {
let json = JSON.stringify(
['mutePost',
{
community: 'hive-180932',
account: user,
permlink: permlink,
notes: 'muted'
}
]);
steem.broadcast.customJson(wif, [], [account], 'community', json, (err, result) => {
if (err)
console.log(err);
else {
console.log('success');
}

});
}

这样程序会24小时自动屏蔽那些新号,减少管理员的工作量,让原CN社区用户更有机会获得某大佬的点赞


This page is synchronized from the post: ‘社区自动屏蔽帖子和用户小程序’

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×