Skip to content

V3#35

Merged
motoki317 merged 13 commits intomasterfrom
v3
May 5, 2023
Merged

V3#35
motoki317 merged 13 commits intomasterfrom
v3

Conversation

@motoki317
Copy link
Copy Markdown
Member

@motoki317 motoki317 commented May 4, 2023

  • ws botを使う
  • service cmdは削除 代わりにdeploy cmdを実装
  • config形態を一新

Comment thread command.go
Comment on lines 20 to 26
type Context struct {
context.Context
// P BOTが受信したMESSAGE_CREATEDイベントの生のペイロード
P *MessageCreatedPayload
P *payload.MessageCreated
// Args 投稿メッセージを空白区切りで分けたもの
Args []string
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

各メソッドの第1引数にcontext入れる方がよく見る気がするんですが構造体の中に入れてるのってなんか意図あったりしますか?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

正直ここでは大した意味はないです embedとして入れてcontext.Contextの拡張として独自のContextを定義しようと思っただけですね
ですが現状ではcontext.Contextの拡張としてはあんまり役割を果たしてないです 今後timeoutとか使いたくなったときに入れることができるくらいです

Context以外の構造体にcontext.Contextを入れて連れ回すのはアンチパターンなのはそうですね

@motoki317 motoki317 merged commit e0225bc into master May 5, 2023
@motoki317 motoki317 deleted the v3 branch May 5, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants