mirror of https://gitlab.com/bashrc2/epicyon
Replace file operations with function
parent
6ad2e4c212
commit
5a4ff22aed
14
reaction.py
14
reaction.py
|
|
@ -510,13 +510,13 @@ def _update_common_reactions(base_dir: str, emoji_content: str) -> None:
|
||||||
if not reaction_found:
|
if not reaction_found:
|
||||||
new_common_reactions.append(str(1).zfill(16) + ' ' + emoji_content)
|
new_common_reactions.append(str(1).zfill(16) + ' ' + emoji_content)
|
||||||
new_common_reactions.sort(reverse=True)
|
new_common_reactions.sort(reverse=True)
|
||||||
try:
|
|
||||||
with open(common_reactions_filename, 'w+',
|
text = ''
|
||||||
encoding='utf-8') as fp_react:
|
for line in new_common_reactions:
|
||||||
for line in new_common_reactions:
|
text += line + '\n'
|
||||||
fp_react.write(line + '\n')
|
if not save_string(text, common_reactions_filename,
|
||||||
except OSError:
|
'EX: error writing common reactions 1 ' +
|
||||||
print('EX: error writing common reactions 1')
|
common_reactions_filename):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
line = str(1).zfill(16) + ' ' + emoji_content + '\n'
|
line = str(1).zfill(16) + ' ' + emoji_content + '\n'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue