mirror of
https://github.com/fotoente/MiCECo.git
synced 2024-10-22 23:19:09 +00:00
Added NoOption error handler for not mandatory options
This commit is contained in:
parent
c20c305fba
commit
a6a442c54e
1 changed files with 8 additions and 6 deletions
|
@ -52,12 +52,12 @@ user = config.get("misskey", "user")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
getReactions = check_str_to_bool(config.get("misskey", "getReaction"))
|
getReactions = check_str_to_bool(config.get("misskey", "getReaction"))
|
||||||
except (TypeError, ValueError) as err:
|
except (TypeError, ValueError, configparser.NoOptionError) as err:
|
||||||
getReactions = False
|
getReactions = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ignoreEmojis = check_str_to_bool(config.get("misskey", "ignoreEmojis"))
|
ignoreEmojis = check_str_to_bool(config.get("misskey", "ignoreEmojis"))
|
||||||
except (TypeError, ValueError) as err:
|
except (TypeError, ValueError, configparser.NoOptionError) as err:
|
||||||
ignoreEmojis = False
|
ignoreEmojis = False
|
||||||
|
|
||||||
if ignoreEmojis:
|
if ignoreEmojis:
|
||||||
|
@ -77,10 +77,13 @@ if ignoreEmojis:
|
||||||
i = element.strip()
|
i = element.strip()
|
||||||
ignored_emojis.append(emojilib.demojize(i))
|
ignored_emojis.append(emojilib.demojize(i))
|
||||||
|
|
||||||
|
try:
|
||||||
noteVisibility = config.get("misskey", "noteVisibility") # How should the note be printed?
|
noteVisibility = config.get("misskey", "noteVisibility") # How should the note be printed?
|
||||||
if noteVisibility != "public" and noteVisibility != "home" and noteVisibility != "followers" and noteVisibility != \
|
if noteVisibility != "public" and noteVisibility != "home" and noteVisibility != "followers" and noteVisibility != \
|
||||||
"specified":
|
"specified":
|
||||||
noteVisibility = "followers"
|
noteVisibility = "followers"
|
||||||
|
except configparser.NoOptionError as err:
|
||||||
|
noteVisibility = "followers"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = requests.post(url + "/users/show", json={"username": user, "host": None, "i": token})
|
req = requests.post(url + "/users/show", json={"username": user, "host": None, "i": token})
|
||||||
|
@ -200,7 +203,6 @@ for element in noteList:
|
||||||
UTF8text = element["text"]
|
UTF8text = element["text"]
|
||||||
UTF8ListRaw = emojilib.distinct_emoji_list(UTF8text) # Find all UTF8 Emojis in Text and CW text
|
UTF8ListRaw = emojilib.distinct_emoji_list(UTF8text) # Find all UTF8 Emojis in Text and CW text
|
||||||
UTF8text = emojilib.demojize(UTF8text)
|
UTF8text = emojilib.demojize(UTF8text)
|
||||||
# TODO urgent! replace "get_emoji_regexp"
|
|
||||||
if len(UTF8ListRaw) > 0:
|
if len(UTF8ListRaw) > 0:
|
||||||
UTF8List = list(set(UTF8ListRaw))
|
UTF8List = list(set(UTF8ListRaw))
|
||||||
for emoji in UTF8List:
|
for emoji in UTF8List:
|
||||||
|
|
Loading…
Reference in a new issue