投稿日:
公式のリファレンスが情報少なすぎるのでメモ
特にこれというフォーマットはなく、ある程度幅広い書式があるようで、公式のドキュメントを見る限り、多少のブレはよしなに解釈してくれるっぽい?
この記事ではoperatorなどの用語が登場しますが、これは私が勝手に名付けたものなので、特に公式の用語ではありません
手組するの面倒なので雑にコマンド生成ツールを作りました。
https://tool.lycolia.info/slack-remider-creator
登録
基本
- フォーマット
/remind [宛先] [メッセージ] [実行日時]
- 例
/remind #random "hoge piyo fuga" at 10:00 every monday, sunday
書式
宛先
| 宛先 | 意味 |
|---|---|
| me | 自分 |
| @someone | メンション |
| #channel | チャンネル |
メッセージ
"hoge piyo fuga"のように書けるが、hoge piyo fugaでも一応通じる
ダブルクォートで囲む場合、改行も利用可能
実行日時
<oparator> <repeat-operator><oparator>で実行日時を設定<repeat-operator>で繰り返しを設定
- 例
at 10:00 every monday, sunday
oparator
| オペレーター | 例 | 意味 |
|---|---|---|
| in <value> (seconds \ | minutes \ | hours) |
| at <HH:mm> | at 1700 | 指定時刻に実行 |
| on <yyyy-MM-dd HH:mm> | on 2023-10-10 09:15 | 指定日時に実行 |
repeat-operator
every <operator>- 例
every monday, sunday
| operator |
|---|
| day |
| weekday |
| sunday, monday, tuesday, wednesday, thursday, friday, saturday |
削除
/remind listでリスト表示して消す
一覧
/remind list
投稿日:
Twilogには特定ツイートを一括で削除する機能がなかったので適当に作りました。
ページネーション機能はないので暇な人作ってください。
事前にページネーションリンクを取得して各ページのHTMLを取得してID引っこ抜けばできると思います。多分
/**
* これは何?
* Twilogで現在表示中のページのツイートをすべて削除します
* 事前に削除対象のツイートを日付選択や検索などで表示した上で実行します
* ページネーション機能はありません
*
* 使い方
* このスクリプトをChromeのDevtoolsのConsoleにコピペして実行します
* 複数ページある場合はページをリロードして同様に操作します
*/
const getSession = () => {
const scr = [...document.getElementsByTagName('script')].find(v => v.text.match(/j-delete-tweet.rb/) !== null)
const mat = scr.text.match(/j-delete-tweet.rb\?c=(.+?)&.+&token=(.+)"/)
return {
c: mat[1],
token: mat[2]
}
}
const getDeleteIdList = () => {
return [...document.getElementsByClassName('tl-del')]
.map((el) => {
const mat = el.children[0].onclick.toString().match(/delete_tweet\('(.+?)','(.+?)',/)
return {
date: mat[1],
status_id: mat[2]
}
}
)
}
const createDeleteRequest = (c, token) => {
return async (date, statusId) => {
return fetch(`https://twilog.org/j-delete-tweet.rb?c=${c}&date=${date}&status_id=${statusId}&token=${token}`)
}
}
const session = getSession()
const requestDelete = createDeleteRequest(session.c, session.token)
const deleteIdList = getDeleteIdList()
let index = 0;
setInterval(async () => {
if (index < deleteIdList.length) {
const del = deleteIdList[index]
const result = await requestDelete(del.date, del.status_id)
console.log(`${index} / ${deleteIdList.length}`, result)
++index
}
}, 1000)