1
0
hugo/content/blog/2019-12-10-weeslack.md

78 lines
2.5 KiB
Markdown
Raw Normal View History

2024-04-23 13:21:26 +00:00
+++
date = "2019-12-10"
tags = ["weechat"]
title = "wee-slackを使ってみた"
slug = "weeslack"
+++
weechatというCLIのIRC Clientがあります。今回は、weechatでslackを使うwee-slackというpluginの紹介です。
https://github.com/wee-slack/wee-slack
## install
```sh
# install
$ sudo pacman -S python-websocket-client weechat
$ mkdir -p ~/.weechat/python/autoload
$ cd ~/.weechat/python
$ url -O https://raw.githubusercontent.com/wee-slack/wee-slack/master/wee_slack.py
$ ln -s ../wee_slack.py autoload
```
次に、`weechat`を起動し、`/slack register`コマンドを実行すると、`https://slack.com/oauth/authorize?client_id=xxx&scope=client`というoauth urlが出てきます。これをブラウザで開きます。
```
# slackに接続
$ weechat
/slack register
#### Retrieving a Slack token via OAUTH ####
1) Paste this into a browser:
https://slack.com/oauth/authorize?client_id=xxx&scope=client
2) Select the team you wish to access from wee-slack in your browser.
3) Click "Authorize" in the browser **IMPORTANT: the redirect will fail, this is
expected**o
If you get a message saying you are not authorized to install wee-slack, the team has
restricted Slack app installation and you will have to request it from an admin. To do
that, go to https://my.slack.com/apps/A1HSZ9V8E-wee-slack and click "Request to
portion of
the URL to "code" portion of the URL to your clipboard
5) Return to weechat and run `/slack register [code]`
```
ブラウザを開いてリダイレクトされたurlのうち`code=xxxxxxx`のxxxの部分がregister番号になります。これを`/slack register xxx`で実行します。また、`https://${my}.slack.com/apps/A1HSZ9V8E-wee-slack`を開いて、wee-slackのアプリを許可します。
```sh
/slack register xxx
/python reload slack
```
## use
これでslackに接続できたと思います。続いて、weechatの使い方です。
weechatはまず`Ctrl + x`でbufferを移動します。user-nameである`[syui]`みたいに表示されたところがslackです。上にアクセス元も表示されます。`xxx.slack.com`
補完も効くので、よく使いそうなコマンドを挙げます。
```sh
# channelに入る
/join #randam
/join syui
# メッセージを投稿, そのまま書けば投稿されます
[syui]test message.
test message.
# weechatを終了する
/exit
```
wee-slackの使い方はこちら
https://github.com/wee-slack/wee-slack/blob/master/docs/Options.md
https://github.com/wee-slack/wee-slack/blob/master/docs/Commands.md