mirror of https://gitlab.com/bashrc2/epicyon
Remove unfollow before new follow
parent
3edc55341b
commit
47601da0be
13
follow.py
13
follow.py
|
@ -1009,6 +1009,19 @@ def sendFollowRequest(session, baseDir: str,
|
||||||
singleUserNickname = 'dev'
|
singleUserNickname = 'dev'
|
||||||
followHandle = singleUserNickname + '@' + requestDomain
|
followHandle = singleUserNickname + '@' + requestDomain
|
||||||
|
|
||||||
|
# remove follow handle from unfollowed.txt
|
||||||
|
unfollowedFilename = acctDir(baseDir, nickname, domain) + '/unfollowed.txt'
|
||||||
|
if os.path.isfile(unfollowedFilename):
|
||||||
|
if followHandle in open(unfollowedFilename).read():
|
||||||
|
unfollowedFile = None
|
||||||
|
with open(unfollowedFilename, 'r') as fp:
|
||||||
|
unfollowedFile = fp.read()
|
||||||
|
unfollowedFile = \
|
||||||
|
unfollowedFile.replace(followHandle + '\n', '')
|
||||||
|
if unfollowedFile:
|
||||||
|
with open(unfollowedFilename, 'w+') as fp:
|
||||||
|
fp.write(unfollowedFile)
|
||||||
|
|
||||||
newFollowJson = {
|
newFollowJson = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': followActor + '/statuses/' + str(statusNumber),
|
'id': followActor + '/statuses/' + str(statusNumber),
|
||||||
|
|
Loading…
Reference in New Issue