Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/database/updatedatabase.py
yzhh c4723fbcd2 breaking change: alias system;don't use while True in the mcv rss check
rename 'wiki_regex' module to 'wiki_inline'
port 'wiki_regex' to 'wiki_inline'
port 'enable' to 'module enable'
port 'disable' to 'module disable'
port 'w' to 'wiki'
port 'u' to 'user'
port 'p' to 'ping'
port 's' to 'server'
rewrite 'enable' help
rewrite 'disable' help
new command parser comming soon.
2021-06-05 18:25:21 +08:00

27 lines
No EOL
981 B
Python

import os
import sqlite3
dbpath = os.path.abspath('./database/save.db')
conn = sqlite3.connect(dbpath)
c = conn.cursor()
a = c.execute(f"SELECT * FROM friend_permission").fetchall()
for x in a:
enabled_split = x[1].split('|')
mv = {'mcv_rss_self': 'mcv_rss', 'mcv_jira_rss_self': 'mcv_jira_rss'}
for y in mv:
if y in enabled_split:
enabled_split.remove(y)
enabled_split.append(mv[y])
c.execute("UPDATE friend_permission SET ENABLE_MODULES=? WHERE ID=?", ('|'.join(enabled_split), x[0]))
conn.commit()
a = c.execute(f"SELECT * FROM group_permission").fetchall()
for x in a:
enabled_split = x[1].split('|')
mv = {'wiki_regex': 'wiki_inline'}
for y in mv:
if y in enabled_split:
enabled_split.remove(y)
enabled_split.append(mv[y])
c.execute("UPDATE group_permission SET ENABLE_MODULES=? WHERE ID=?", ('|'.join(enabled_split), x[0]))
conn.commit()