Skip to content

Commit

Permalink
scheduled messages will send using private api, if enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zlshames committed Oct 9, 2022
1 parent 2fa3500 commit 53b9f64
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,14 @@ export class ScheduledMessagesService {
scheduledMessage.status = ScheduledMessageStatus.IN_PROGRESS;
this.saveScheduledMessage(scheduledMessage);

// Inject the method based on if it's not already provided,
// or if the private api is enabled on the server & connected.
if (!scheduledMessage.payload.method) {
const papiEnabled = Server().repo.getConfig("enable_private_api") as boolean;
scheduledMessage.payload.method =
papiEnabled && !!Server().privateApiHelper.helper ? "private-api" : "apple-script";
}

// Send the message
try {
if (scheduledMessage.type === ScheduledMessageType.SEND_MESSAGE) {
Expand Down

0 comments on commit 53b9f64

Please sign in to comment.