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/modules/mcvrss.py

43 lines
894 B
Python
Raw Normal View History

2020-07-30 14:44:17 +00:00
import os
import re
2020-08-19 04:41:47 +00:00
from os.path import abspath
2020-08-12 16:01:34 +00:00
2020-09-19 10:35:13 +00:00
2020-07-30 14:44:17 +00:00
def mcvrss():
2020-08-19 04:41:47 +00:00
w = open(abspath('./mcvrss.txt'), 'r')
2020-07-30 14:44:17 +00:00
s = w.read().split('\n')
2020-07-30 14:48:03 +00:00
if '' in s:
s.remove('')
2020-07-30 14:44:17 +00:00
w.close()
2020-08-15 08:26:35 +00:00
return (s)
2020-08-12 16:01:34 +00:00
2020-07-30 14:44:17 +00:00
def mcvrssa(group):
q = mcvrss()
if group in q:
2020-08-12 16:01:34 +00:00
return ('该群已在订阅列表中。')
2020-07-30 14:44:17 +00:00
else:
2020-08-18 05:37:35 +00:00
wr = open('../mcvrss.txt', 'a+')
2020-08-12 16:01:34 +00:00
wr.write(re.sub(r'\n$', '', '\n' + group))
2020-07-30 14:44:17 +00:00
wr.close()
2020-08-12 16:01:34 +00:00
return ('已订阅。')
2020-07-30 14:44:17 +00:00
def mcvrssr(group):
q = mcvrss()
if group in q:
q.remove(group)
2020-08-18 05:37:35 +00:00
os.remove('../mcvrss.txt')
wr = open('../mcvrss.txt', 'a')
2020-07-30 14:44:17 +00:00
y = []
h = ''
for x in q:
2020-08-21 12:40:05 +00:00
y.append(x + '\n')
2020-07-30 14:44:17 +00:00
g = h.join(y)
2020-08-12 16:01:34 +00:00
k = re.sub(r'\n$', '', g)
2020-07-30 14:44:17 +00:00
wr.write(k)
wr.close()
2020-08-12 16:01:34 +00:00
return ('已移除订阅。')
2020-07-30 14:44:17 +00:00
else:
2020-08-12 16:01:34 +00:00
return ('此群不在订阅列表中。')