Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement helloworld bot #941

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Implement helloworld bot #941

wants to merge 9 commits into from

Conversation

hakatashi
Copy link
Member

@hakatashi hakatashi commented Oct 2, 2024

実装したこと

slackbot開発時のAPIの動作確認、および他のBOTを開発する際の雛形として使えるBOT、「helloworld」を実装しました。

image

image

ユニットテストやESLintの設定など、Slackbotとして必要な最低限の機能が備わっています。

副次的修正

また、このBOTを作成する過程で Slack Node SDK を更新したところ、型定義がより厳密になったことでTypeScriptの型エラーが発生したため、slackbot全体のエラーを修正しました。

特に大きな修正点として、ChatPostMessageArgumentsの型定義が大幅に修正され、以下のようなオプション指定が不可となりました。

  • icon_urlicon_emoji を同時に指定する
  • thread_ts を指定せずに reply_broadcast を指定する
  • channel を指定しない

これらに基づいて各所のオプションの指定を修正しました。特にAteQuizの solvedMessageunsolvedMessage の指定では thread_ts を指定せずに reply_broadcast を指定している部分が大半だったため、AteQuiz側で reply_broadcast オプションの値を制御し、呼び出し側では指定しなくて良くなるようにしました。

また、WebAPICallOptions が削除されたため、これも都度適切な型を参照するように修正しています。

その他の修正内容

  • chat.update メソッドの呼び出し時に username, icon_emoji などを指定している部分を削除 (以前から指定する意味はなかったと思われる)
  • ChatPostMessageArguments型において username などが必須のプロパティでなくなったため、テストなどでは in type guard を用いたコードに修正
  • 飛んできたEventや Interactive Message の内容をデバッグ出力するよう修正
  • Unhandled Promise Rejection のエラースタックを表示するよう修正

@hakatashi hakatashi self-assigned this Oct 2, 2024
@hakatashi hakatashi marked this pull request as ready for review October 3, 2024 06:35
Copy link
Contributor

@Yosshi999 Yosshi999 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@platypus999 platypus999 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants