Add Discord inbound replies (#15)
Stacks on #14. Mapped Discord admins can reply in a known thread; those messages become site posts and email the homeowner. The bot does not publish a site event, so the reply is not posted back to Discord. Photo attachments are ignored until the upload pipeline lands on this branch. Reviewed-on: #15 Co-authored-by: codegirl-007 <s.raide@gmail.com>
This commit was merged in pull request #15.
This commit is contained in:
@@ -204,7 +204,7 @@ func TestFormatMessage(t *testing.T) {
|
||||
func TestFromEnvDisabled(t *testing.T) {
|
||||
t.Setenv("DISCORD_BOT_TOKEN", "")
|
||||
t.Setenv("DISCORD_CHANNEL_ID", "")
|
||||
bot, err := FromEnv(newMemoryLinks(), nil)
|
||||
bot, err := FromEnv(newMemoryLinks(), nil, nil, nil)
|
||||
if err != nil || bot != nil {
|
||||
t.Fatalf("disabled FromEnv = (%v, %v)", bot, err)
|
||||
}
|
||||
@@ -213,12 +213,12 @@ func TestFromEnvDisabled(t *testing.T) {
|
||||
func TestFromEnvRequiresBoth(t *testing.T) {
|
||||
t.Setenv("DISCORD_BOT_TOKEN", "token")
|
||||
t.Setenv("DISCORD_CHANNEL_ID", "")
|
||||
if _, err := FromEnv(newMemoryLinks(), nil); err == nil {
|
||||
if _, err := FromEnv(newMemoryLinks(), nil, nil, nil); err == nil {
|
||||
t.Fatal("expected error when channel is missing")
|
||||
}
|
||||
t.Setenv("DISCORD_BOT_TOKEN", "")
|
||||
t.Setenv("DISCORD_CHANNEL_ID", "channel")
|
||||
if _, err := FromEnv(newMemoryLinks(), nil); err == nil {
|
||||
if _, err := FromEnv(newMemoryLinks(), nil, nil, nil); err == nil {
|
||||
t.Fatal("expected error when token is missing")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user