diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 325d77c..0f50cb5 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: 1.18 - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..3fff643 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,9 @@ +run: + timeout: "3m" + issue-exit-code: 1 + tests: true + skip-dirs-use-default: true + skip-files: + - pkg/dgvoice/.*.go$ + - pkg/speech/win32/.*.go$ + go: 1.18 diff --git a/pkg/slashCmd/dict.go b/pkg/slashCmd/dict.go index 3c06857..0f6ba51 100644 --- a/pkg/slashCmd/dict.go +++ b/pkg/slashCmd/dict.go @@ -5,6 +5,7 @@ import ( "log" "github.com/azuki-bar/ceviord/pkg/ceviord" + "github.com/azuki-bar/ceviord/pkg/logging" "github.com/azuki-bar/ceviord/pkg/replace" "github.com/bwmarrin/discordgo" "github.com/k0kubun/pp" @@ -42,10 +43,13 @@ func (*dict) handle(c chan<- bool, s *discordgo.Session, i *discordgo.Interactio } func replySimpleMsg(msg string, s *discordgo.Session, i *discordgo.Interaction) { - s.InteractionRespond(i, &discordgo.InteractionResponse{ + err := s.InteractionRespond(i, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{Content: msg}, }) + if err != nil { + ceviord.Logger.Log(logging.WARN, "reply simple msg", err) + } } func dictSubCmdParse(opt *discordgo.ApplicationCommandInteractionDataOption) (dictSubCmd, error) { diff --git a/pkg/slashCmd/slashCmd.go b/pkg/slashCmd/slashCmd.go index 1c73605..6f8b1c8 100644 --- a/pkg/slashCmd/slashCmd.go +++ b/pkg/slashCmd/slashCmd.go @@ -75,10 +75,7 @@ func InteractionHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { case <-finish: return case <-time.After(2500 * time.Millisecond): - s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ - Type: discordgo.InteractionResponseChannelMessageWithSource, - Data: &discordgo.InteractionResponseData{Content: "handler connection timeout"}, - }) + replySimpleMsg("コネクションがタイムアウトしました。", s, i.Interaction) } }