-
Notifications
You must be signed in to change notification settings - Fork 5
/
moderabot.py
25 lines (21 loc) · 991 Bytes
/
moderabot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from common import get_api
from common import list_read
from common import list_append
bot_name = 'moderabot'
api = get_api('masto.es', bot_name)
notifications = api.notifications(types=["admin.sign_up"])
# Vietnamese accounts
forbidden_words = list_read('moderabot_forbidden_words')
for n in notifications:
for word in forbidden_words:
if word in n['account']['note']:
api.admin_account_moderate(n['account']['id'], action='suspend', send_email_notification=False)
list_append(bot_name + "_banned", n['account']['acct'])
print("banned: " + n['account']['acct'])
# Known spam accounts with similar names
names = list_read('moderabot_forbidden_names')
for name in names:
result = api.search_v2(name, result_type='accounts', resolve=False)
for account in result['accounts']:
api.admin_account_moderate(account['id'], action='suspend', send_email_notification=False)
list_append(bot_name + "_banned", account['acct'])