refactor(simplex): hoist json.dumps above branch in _standalone_send
Deduplicate the composed JSON payload construction — both the group and DM branches build the identical json.dumps result, so hoist it above the if/else to match the pattern already used in send().
This commit is contained in:
parent
eb048772f6
commit
0041fc6946
|
|
@ -1262,16 +1262,13 @@ async def _standalone_send(
|
|||
return {"error": "SimpleX standalone send: SIMPLEX_WS_URL is required"}
|
||||
|
||||
try:
|
||||
composed = json.dumps(
|
||||
[{"msgContent": {"type": "text", "text": message}}]
|
||||
)
|
||||
if chat_id.startswith("group:"):
|
||||
group_id = chat_id[6:]
|
||||
composed = json.dumps(
|
||||
[{"msgContent": {"type": "text", "text": message}}]
|
||||
)
|
||||
cmd_str = f"/_send #{group_id} json {composed}"
|
||||
else:
|
||||
composed = json.dumps(
|
||||
[{"msgContent": {"type": "text", "text": message}}]
|
||||
)
|
||||
cmd_str = f"/_send @{chat_id} json {composed}"
|
||||
|
||||
payload = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue