From 9100cf5977d8062909736b596ca2b720a17ded2d Mon Sep 17 00:00:00 2001 From: wan Date: Fri, 2 Sep 2022 17:44:03 +0900 Subject: [PATCH] =?UTF-8?q?[#225]=20slackclient=E3=81=AE=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E5=90=8D=E5=A4=89=E6=9B=B4=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=80=81github=E3=81=8B=E3=82=89install=E3=81=99=E3=82=8B?= =?UTF-8?q?=E6=99=82=E3=81=AB=E6=8E=A8=E5=A5=A8=E3=81=95=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E6=96=B9=E6=B3=95=E3=81=A7=E3=82=84=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constraints.txt | 3 +-- src/haro/botmessage.py | 6 +++--- src/haro/plugins/amesh.py | 9 +++++---- src/haro/plugins/redmine.py | 4 ++-- src/requirements.txt | 1 + 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/constraints.txt b/src/constraints.txt index 4e4060f..0fcada7 100644 --- a/src/constraints.txt +++ b/src/constraints.txt @@ -3,7 +3,7 @@ cachetools==2.0.1 certifi==2017.7.27.1 chardet==3.0.4 geopy==1.11.0 --e git+git@github.com:ebmdatalab/slackbot@develop#egg=slackbot +git+https://git@github.com/ebmdatalab/slackbot@develop#egg=slackbot idna==2.6 kml2geojson==4.0.2 Mako==1.0.7 @@ -15,7 +15,6 @@ python-dateutil==2.6.1 python-editor==1.0.3 requests==2.24.0 six==1.11.0 -slackbot==1.0.0 slacker==0.14.0 SQLAlchemy==1.3.19 urllib3==1.22 diff --git a/src/haro/botmessage.py b/src/haro/botmessage.py index fe762b8..ba1eba5 100644 --- a/src/haro/botmessage.py +++ b/src/haro/botmessage.py @@ -38,7 +38,7 @@ def webapisend(message, text): channel = message.channel channel_id = channel._body['id'] if 'thread_ts' in message.body: - sc.chat.post_message(channel_id, text=text, as_user=True, - unfurl_links=True, thread_ts=message.thread_ts) + sc.chat_postMessage(channel=channel_id, text=text, as_user=True, + unfurl_links=True, thread_ts=message.thread_ts) else: - sc.chat.post_message(channel_id, text=text, as_user=True, unfurl_links=True) + sc.chat_postMessage(channel=channel_id, text=text, as_user=True, unfurl_links=True) diff --git a/src/haro/plugins/amesh.py b/src/haro/plugins/amesh.py index 113970e..0f0dd70 100644 --- a/src/haro/plugins/amesh.py +++ b/src/haro/plugins/amesh.py @@ -69,14 +69,15 @@ def amesh(message): # 外部サイトに投稿してURLを貼る方法(S3とか)だとaccesskey設定等いるのでslackに直接アップロード sc = message._client.webapi - sc.files.upload( - file_=tmpname, + + sc.files_upload( + file=tmpname, initial_comment=comment, title=name, filename=name, - channels=message.channel._body["name"], + channels=message._body["channel"], ) - except Exception: + except Exception: # NOQA logger.exception("amesh exception") if i == MAX_RETRY_NUM: botsend(message, "{}回目: だめでした…またためしてね".format(i)) diff --git a/src/haro/plugins/redmine.py b/src/haro/plugins/redmine.py index fef955c..9c1f307 100644 --- a/src/haro/plugins/redmine.py +++ b/src/haro/plugins/redmine.py @@ -143,8 +143,8 @@ def show_ticket_information(message, *ticket_ids): # NOQA: R701, C901 url = "{}{}".format(ticket.url, note_suffix) sc = message._client.webapi - res = sc.chat.post_message(channel_id, "<{}|{}>".format(url, text), as_user=True) - sc.chat.post_message(channel_id, description, as_user=True, thread_ts=res.body['ts']) + res = sc.chat_postMessage(channel=channel_id, text="<{}|{}>".format(url, text), as_user=True) + sc.chat_postMessage(channel=channel_id, text=description, as_user=True, thread_ts=res.body['ts']) @respond_to(r'^redmine\s+key\s+(\S+)$') diff --git a/src/requirements.txt b/src/requirements.txt index 9cf1031..4605b40 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -10,6 +10,7 @@ prettytable cachetools python-redmine slackclient +slacker geopy kml2geojson