From bfedad14952bad03809c8cb9def72e7c78706c27 Mon Sep 17 00:00:00 2001 From: fumi232323 Date: Tue, 8 Sep 2020 13:21:32 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refs=20#56=20=E3=83=A9=E3=82=A4=E3=83=96?= =?UTF-8?q?=E3=83=A9=E3=83=AA=20slackbot=20=E3=81=AE=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E6=9C=80=E6=96=B0=E3=81=AE?= =?UTF-8?q?=201.0.0=20=E3=81=AB=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constraints.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constraints.txt b/src/constraints.txt index c06e19b..9eb01fd 100644 --- a/src/constraints.txt +++ b/src/constraints.txt @@ -14,7 +14,7 @@ python-dateutil==2.6.1 python-editor==1.0.3 requests==2.18.4 six==1.11.0 -slackbot==0.5.1 +slackbot==1.0.0 slacker==0.9.60 SQLAlchemy==1.2.2 urllib3==1.22 From b89ab4af6b9b141b59a40b18b4368d87d72dcb31 Mon Sep 17 00:00:00 2001 From: fumi232323 Date: Tue, 8 Sep 2020 13:21:50 +0900 Subject: [PATCH 2/5] refs #56 fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3906b29..dd84b85 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ $ (cd beproudbot/deployment && ~/venv_ansible/bin/ansible-playbook -i hosts --co - `$water count`: 現在の残数を返す - `$water num`: 水を取り替えた時に使用。指定した数だけ残数を減らす(numが負数の場合、増やす) -- `$water hitsory `: 指定した件数分の履歴を返す(default=10) +- `$water history `: 指定した件数分の履歴を返す(default=10) - `$water help`: このコマンドの使い方を返す ### kintai コマンド From b64e227884effd70c641cd4536c0d8e05cbc1bc6 Mon Sep 17 00:00:00 2001 From: fumi232323 Date: Tue, 8 Sep 2020 14:55:50 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refs=20#56=20channels=20=E3=81=A8=20groups?= =?UTF-8?q?=20=E3=81=AF=E5=BB=83=E6=AD=A2=E4=BA=88=E5=AE=9A=20&=20conversa?= =?UTF-8?q?tions=20=E3=81=B8=E7=B5=B1=E5=90=88=E3=81=95=E3=82=8C=E3=81=9F?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=80=81=E3=83=A1=E3=83=B3=E3=83=90=E3=83=BC?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E6=99=82=E3=81=AB=E4=BD=BF=E7=94=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B=20API=20=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/haro/plugins/random.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/haro/plugins/random.py b/src/haro/plugins/random.py index 83f5ba7..1d8cd68 100644 --- a/src/haro/plugins/random.py +++ b/src/haro/plugins/random.py @@ -1,3 +1,4 @@ +import logging import random from slackbot.bot import respond_to @@ -13,6 +14,8 @@ - `$random help`: randomコマンドの使い方を返す ''' +logger = logging.getLogger(__name__) + @respond_to('^random$') @respond_to('^random\s+(active|help)$') @@ -20,7 +23,7 @@ def random_command(message, subcommand=None): """ チャンネルにいるメンバーからランダムに一人を選んで返す - https://github.com/os/slacker - - https://api.slack.com/methods/channels.info + - https://api.slack.com/methods/conversations.members - https://api.slack.com/methods/users.getPresence - https://api.slack.com/methods/users.info """ @@ -33,16 +36,11 @@ def random_command(message, subcommand=None): channel = message.body['channel'] webapi = slacker.Slacker(settings.API_TOKEN) try: - cinfo = webapi.channels.info(channel) - members = cinfo.body['channel']['members'] + cinfo = webapi.conversations.members(channel) + members = cinfo.body['members'] except slacker.Error: - try: - cinfo = webapi.groups.info(channel) - members = cinfo.body['group']['members'] - except slacker.Error: - # TODO: 例外で判定しないように修正する - # チャンネルに紐付かない場合はreturn - return + logger.exception('An error occurred while fetching members: channel=%s', channel) + return # bot の id は除く bot_id = message._client.login_data['self']['id'] From 089b782dd1a2a41e4f6cae37157fc9140824f692 Mon Sep 17 00:00:00 2001 From: fumi232323 Date: Tue, 8 Sep 2020 14:59:49 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refs=20#56=20slackbot=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E5=8C=96=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=81=A6=20slacke?= =?UTF-8?q?r=20=E3=82=82=E6=9C=80=E6=96=B0=E3=81=AB=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=A2=E3=83=83=E3=83=97=20(?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=A2=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=81=97=E3=81=AA=E3=81=84=E3=81=A8=20slackbot.conver?= =?UTF-8?q?sations=20API=20=E7=BE=A4=E3=81=8C=E4=BD=BF=E3=81=88=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=82=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constraints.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constraints.txt b/src/constraints.txt index 9eb01fd..7583fd9 100644 --- a/src/constraints.txt +++ b/src/constraints.txt @@ -15,7 +15,7 @@ python-editor==1.0.3 requests==2.18.4 six==1.11.0 slackbot==1.0.0 -slacker==0.9.60 +slacker==0.14.0 SQLAlchemy==1.2.2 urllib3==1.22 websocket-client==0.44.0 From 4104416ae72f98486dbeed43cbf0f24febae7314 Mon Sep 17 00:00:00 2001 From: fumi232323 Date: Wed, 9 Sep 2020 10:51:20 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refs=20#56=20=E6=9C=80=E6=96=B0=E3=81=AE=20?= =?UTF-8?q?setuptools=20=E3=81=A0=E3=81=A8=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E5=87=BA=E3=82=8B=E3=81=9F=E3=82=81=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=A2=E3=83=83=E3=83=97=20(?= =?UTF-8?q?=E5=8F=82=E8=80=83:=20https://github.com/pallets/markupsafe/iss?= =?UTF-8?q?ues/116)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constraints.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constraints.txt b/src/constraints.txt index 7583fd9..db4b7c2 100644 --- a/src/constraints.txt +++ b/src/constraints.txt @@ -6,7 +6,7 @@ geopy==1.11.0 idna==2.6 kml2geojson==4.0.2 Mako==1.0.7 -MarkupSafe==1.0 +MarkupSafe==1.1.1 Pillow==5.2.0 prettytable==0.7.2 PyMySQL==0.7.11