Fixed not saving locale config

This commit is contained in:
spla 2022-08-18 13:13:23 +02:00
parent 20fbdba2fe
commit cf10f4818d
1 changed files with 6 additions and 20 deletions

View File

@ -1,5 +1,5 @@
from mastodon import Mastodon
from mastodon import MastodonMalformedEventError, MastodonNetworkError, MastodonReadTimeout, MastodonAPIError, MastodonIllegalArgumentError
from mastodon.Mastodon import MastodonMalformedEventError, MastodonNetworkError, MastodonReadTimeout, MastodonAPIError, MastodonIllegalArgumentError
import getpass
import unidecode
import fileinput,re
@ -126,12 +126,7 @@ class Mastodonbot:
mastodon = Mastodon(client_id = "app_clientcred.txt", api_base_url = self.mastodon_hostname)
grant_type = 'password'
mastodon.__log_in(
client_id,
client_secret,
grant_type,
mastodon.log_in(
user_name,
user_password,
scopes = ["read", "write"],
@ -200,7 +195,6 @@ class Mastodonbot:
self.__create_config(self)
self.__write_config(self)
self.__read_config_line(self)
print("Secrets setup done!\n")
@ -298,18 +292,10 @@ class Mastodonbot:
with open(self.config_filepath, 'a') as the_file:
the_file.write('mastodon_hostname: \n')
print(f"adding parameter 'mastodon_hostname' to {self.config_filepath}")
print(f"adding parameter 'bot_lang' to {self.config_filepath}")
@staticmethod
def __read_config_line(self):
with open(self.config_filepath) as fp:
line = fp.readline()
self.__modify_file(self, self.config_filepath, "mastodon_hostname: ", value=self.mastodon_hostname)
self.__modify_file(self, self.config_filepath, "bot_lang: ", value=self.__bot_lang)
the_file.write(f'mastodon_hostname: {self.mastodon_hostname}\n')
the_file.write(f'bot_lang: {self.__bot_lang}\n')
print(f"adding parameter 'mastodon_hostname' to {self.config_filepath}\n")
print(f"adding parameter 'bot_lang' to {self.config_filepath}\n")
def get_data(self, notif):