-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
package processors | ||
|
||
import "github.com/slack-go/slack" | ||
import ( | ||
"runtime" | ||
|
||
"github.com/rusq/dlog" | ||
"github.com/slack-go/slack" | ||
) | ||
|
||
type Discarder struct{} | ||
|
||
func (d *Discarder) Messages(messages []slack.Message) error { | ||
dlog.Printf("Discarding %d messages", len(messages)) | ||
for i := range messages { | ||
dlog.Printf(" message: %s", messages[i].Timestamp) | ||
} | ||
return nil | ||
} | ||
|
||
func (d *Discarder) ThreadMessages(parent slack.Message, replies []slack.Message) error { | ||
dlog.Printf("Discarding %d replies to %s", len(replies), parent.Timestamp) | ||
for i := range replies { | ||
dlog.Printf(" reply: %s", replies[i].Timestamp) | ||
} | ||
return nil | ||
} | ||
|
||
func (d *Discarder) Files(parent slack.Message, isThread bool, files []slack.File) error { | ||
dlog.Printf("Discarding %d files to %s (thread: %v)", len(files), parent.Timestamp, isThread) | ||
if parent.Timestamp == "" { | ||
runtime.Breakpoint() | ||
} | ||
for i := range files { | ||
dlog.Printf(" file: %s", files[i].ID) | ||
} | ||
return nil | ||
} | ||
|
||
func (d *Discarder) Files(parent slack.Message, files []slack.File) error { | ||
func (d *Discarder) Close() error { | ||
dlog.Println("Discarder closing") | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
package processors | ||
|
||
import "github.com/slack-go/slack" | ||
import ( | ||
"io" | ||
|
||
"github.com/slack-go/slack" | ||
) | ||
|
||
// Channeller is the interface for conversation fetching. | ||
type Channeller interface { | ||
// Messages is called for each message that is retrieved. | ||
Messages(m []slack.Message) error | ||
// Files is called for each file that is retrieved. The parent message is | ||
// passed in as well. | ||
Files(parent slack.Message, m []slack.File) error | ||
Files(parent slack.Message, isThread bool, m []slack.File) error | ||
// ThreadMessages is called for each of the thread messages that are | ||
// retrieved. The parent message is passed in as well. | ||
ThreadMessages(parent slack.Message, tm []slack.Message) error | ||
|
||
io.Closer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters