change code of write file
This commit is contained in:
@ -222,9 +222,8 @@ class kuser:
|
|||||||
def send_answer(self, text, file_id):
|
def send_answer(self, text, file_id):
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
if text != '':
|
if text != '':
|
||||||
f = open(self.username + self.question + '.c', 'w')
|
with open(self.username + self.question + '.c', 'w') as f:
|
||||||
f.write(text)
|
f.write(text)
|
||||||
f.close()
|
|
||||||
else:
|
else:
|
||||||
bot.download_file(file_id, self.username + self.question + '.c')
|
bot.download_file(file_id, self.username + self.question + '.c')
|
||||||
self.api.delete_answer(self.question)
|
self.api.delete_answer(self.question)
|
||||||
|
Reference in New Issue
Block a user