mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
extended receive endpoint + AUTO_RECEIVE_SCHEDULE functionality
* added timeout, ignore_attachments and ignore_stories query parameter to receive endpoint. * added AUTO_RECEIVE_SCHEDULE_RECEIVE_TIMEOUT, AUTO_RECEIVE_SCHEDULE_IGNORE_ATTACHMENTS and AUTO_RECEIVE_SCHEDULE_IGNORE_STORIES environment variables to the AUTO_RECEIVE_SCHEDULE functionality. see #365
This commit is contained in:
@@ -595,12 +595,20 @@ func (s *SignalClient) SendV2(number string, message string, recps []string, bas
|
||||
return ×tamps, nil
|
||||
}
|
||||
|
||||
func (s *SignalClient) Receive(number string, timeout int64) (string, error) {
|
||||
func (s *SignalClient) Receive(number string, timeout int64, ignoreAttachments bool, ignoreStories bool) (string, error) {
|
||||
if s.signalCliMode == JsonRpc {
|
||||
return "", errors.New("Not implemented")
|
||||
} else {
|
||||
command := []string{"--config", s.signalCliConfig, "--output", "json", "-a", number, "receive", "-t", strconv.FormatInt(timeout, 10)}
|
||||
|
||||
if ignoreAttachments {
|
||||
command = append(command, "--ignore-attachments")
|
||||
}
|
||||
|
||||
if ignoreStories {
|
||||
command = append(command, "--ignore-stories")
|
||||
}
|
||||
|
||||
out, err := s.cliClient.Execute(true, command, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user