Invite tokens were trying to save to the wrong place, but failing anyway, and some other bugs.

This commit is contained in:
2024-03-24 05:16:36 +11:00
parent 620f780113
commit 43c4ff2d75
2 changed files with 20 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ def _load(name,pos,file,obj):
for line in linegen(file):
split=line.split(',')
if split[pos]==name: return obj(*split)
raise Exception('No such',obj.__name__,'with identifier',name)
raise Exception(f'No such {obj.__name__} with identifier {name}')
def _load_multi(name,pos,file,obj):
out=[]
for line in linegen(file):
@@ -62,7 +62,7 @@ def delete_invite(token):
def linegen(path):
i=0
file=open(path)
line=file.readline()
line=file.readline().rstrip('\n') # Maybe sometimes there won't be one.
while line:
i+=1
response=yield line
@@ -91,7 +91,7 @@ def writefile(path,action,post=None):
while line:
i+=1
action(write,i,line)
line=file.readline()
line=file.readline().rstrip('\n')
if post is not None: post(write)
file.close()
write.close()