-
Notifications
You must be signed in to change notification settings - Fork 7
/
responsepolicy.go
36 lines (31 loc) · 1.01 KB
/
responsepolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ken
// ResponsePolicy describes rules for context
// followups and responses.
type ResponsePolicy struct {
// When set to true, the command response will
// only be received by the sender of the command.
//
// This sets the `Ephemeral` flag of the `Context`
// to true before any middleware is invoked. So,
// you are able to modify the ephemeral flag either
// in your middleware or directly in your command
// logic, if you desire.
Ephemeral bool
}
// ResponsePolicyCommand defines a command which
// provides a ResponsePolicy.
type ResponsePolicyCommand interface {
ResponsePolicy() ResponsePolicy
}
// EphemeralCommand can be added to your command
// to make all command responses ephemeral.
// This means, that all responses to the command
// from the bot will only be received by the sender
// of the command.
type EphemeralCommand struct{}
var _ ResponsePolicyCommand = (*EphemeralCommand)(nil)
func (EphemeralCommand) ResponsePolicy() ResponsePolicy {
return ResponsePolicy{
Ephemeral: true,
}
}