ISSHA-1329 add member rewrite#48
Open
koedoyoshida wants to merge 9 commits intomasterfrom
Open
Conversation
add all bot help option mention name from real_name or display_name
takanory
requested changes
Feb 28, 2021
| - `$cal`: 今月のカレンダーを返す | ||
| - `$cal 9`: 今年の指定された月のカレンダーを返す | ||
| - `$cal 9 2016`: 指定された年月のカレンダーを返す | ||
| - `$members`: チャンネルにいる通常の参加者のメンション名の一覧を返す |
Member
There was a problem hiding this comment.
MUST: membersは別プラグインなので、新しい見出し members plugin を追加して、そこに書いてください
| import slacker | ||
| import json | ||
|
|
||
| from ..botmessage import botsend, botreply, botwebapi |
Member
There was a problem hiding this comment.
SHOULD 使っていない import があるので削除してください
| チャンネル参加者のメンション名の一覧を返す | ||
|
|
||
| - https://github.com/os/slacker | ||
| - https://api.slack.com/methods/conversations.members |
Member
There was a problem hiding this comment.
channels.infoはdeprecatedになったので、APIを変更しました
| - https://github.com/os/slacker | ||
| - https://api.slack.com/methods/conversations.members | ||
| - https://api.slack.com/methods/users.list | ||
| - https://api.slack.com/methods/users.getPresence |
Member
There was a problem hiding this comment.
SHOULD: このあたりのAPIも使ってなさそうなので削除してほしい
| continue | ||
|
|
||
| # idが複数ヒットした場合警告を出す | ||
| if len(memberkeys) > 1: |
| # このチャンネルのメンバーを順次処理 | ||
| for member_id in members: | ||
| # 全ユーザー情報リストから該当するユーザで抽出 | ||
| memberkeys = [x for x in all_user_info.body['members'] |
Member
There was a problem hiding this comment.
MAY: ループの外側で
[x for x in all_user_info.body['members'] if x['id'] in members] で一度にリスト作っちゃうんじゃだめかなーって思いました(動作確認はしてません)
| display_name = memberkeys[0]['profile']['display_name'] | ||
|
|
||
| # display_nameが設定されていればそれを優先 | ||
| if display_name != "": |
| # 探しやすいように大小文字区別なしアルファベット順 | ||
| member_list.sort(key=str.lower) | ||
|
|
||
| pretext = 'このチャンネルの{0}参加者は以下{1}名です。'.format(desc, len(member_list)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
チケット
レビューしてほしいところ
#35
の指摘反映書き直し版です。