Skip to content

Commit 8e2eb38

Browse files
committed
CHANGES:
- RestAPI: deprecation removed BUGFIX: - Mission: forum channels were not detected correctly - Added late reads for serverSettings.lua / options.lua on cloud drives.
1 parent 492a672 commit 8e2eb38

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

core/utils/helper.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@
2323
import traceback
2424
import unicodedata
2525

26-
# for eval
27-
import random
28-
import math
29-
3026
from collections.abc import Mapping
3127
from copy import deepcopy
3228
from croniter import croniter
3329
from datetime import datetime, timedelta, timezone, tzinfo
3430
from difflib import unified_diff
3531
from importlib import import_module
32+
from lupa.lua51 import LuaSyntaxError
3633
from pathlib import Path
3734
from typing import TYPE_CHECKING, Generator, Iterable, Callable, Any
3835
from urllib.parse import urlparse
@@ -797,16 +794,18 @@ def read_file(self):
797794
self.mtime = os.path.getmtime(self.path)
798795
data = None
799796
if self.path.lower().endswith('.lua'):
800-
content = None
801797
try:
802-
#data = luadata.read(self.path, encoding='utf-8')
803-
with open(self.path, mode='r', encoding='utf-8') as infile:
804-
content = infile.read()
805-
data = luadata.unserialize(content, encoding='utf-8')
798+
ex = None
799+
for i in range(0, 3):
800+
try:
801+
data = luadata.read(self.path, encoding='utf-8')
802+
break
803+
except LuaSyntaxError as ex:
804+
time.sleep(0.5)
805+
else:
806+
raise ex
806807
except Exception as ex:
807808
self.log.debug(f"Exception while reading {self.path}:\n{ex}")
808-
if content:
809-
self.log.debug("Content:\n{}".format(content))
810809
data = alternate_parse_settings(self.path)
811810
if not data:
812811
self.log.error("- Error while parsing {}:\n{}".format(os.path.basename(self.path), ex))
@@ -1080,6 +1079,9 @@ def evaluate(value: str | int | float | bool | list | dict, **kwargs) -> str | i
10801079
If the input value is a string starting with '$', it will be evaluated with placeholders replaced by keyword arguments.
10811080
"""
10821081
def _evaluate(value, **kwargs):
1082+
import random
1083+
import math
1084+
10831085
if isinstance(value, (int, float, bool)) or not value.startswith('$'):
10841086
return value
10851087
value = format_string(value[1:], **kwargs)

plugins/mission/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ async def update_channel_name(self):
23422342
# name changes of the status channel will only happen with the correct permission
23432343
if not channel.permissions_for(self.bot.member).manage_channels:
23442344
return
2345-
if channel.type == discord.ChannelType.forum:
2345+
if channel.type in [discord.ChannelType.forum, discord.ChannelType.public_thread]:
23462346
continue
23472347
# TODO: Alternative implementation, if Discord decides to no longer use system messages for a thread rename
23482348
# for thread in channel.threads:

plugins/restapi/commands.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,9 @@ async def squadron_credits(self, name: str = Form(...), campaign: str = Form(def
906906
return SquadronCampaignCredit.model_validate({"campaign": row[1], "credits": squadron_obj.points})
907907

908908
async def linkme(self,
909-
discord_id: str = Form(..., description="Discord user ID (snowflake)", example="123456789012345678"),
910-
force: bool = Form(False, description="Force the operation", example=True)):
909+
discord_id: str = Form(..., description="Discord user ID (snowflake)",
910+
examples=["123456789012345678"]),
911+
force: bool = Form(False, description="Force the operation")):
911912

912913
async def create_token() -> str:
913914
while True:

0 commit comments

Comments
 (0)