clemmy/commands.sh

23 lines
1.3 KiB
Bash
Raw Normal View History

2023-01-17 01:07:40 +11:00
actions="notifs notifs2 comments freepost shitpost follow unfollow home deref whoami login"
#Endpoints.
#Lurkan
notifs(){ getauth "user/replies" ".replies | reverse | $notifs"; }
notifs2(){ getauth "user/mention" ".mentions | reverse | $notifs"; }
following(){ echo "use <home> instead"; } # Maybe this will help.
home(){ getauth "post/list" ".posts | $posts" "type_=Subscribed"; }
comments(){ getauth "post" "(.post_view | $showpost), (.comments | reverse | $comments)" "id=$1"; }
#Postan
freepost(){ getbody; post "post" "{\"community_id\":$1,\"name\":\"${*:2}\",\"body\":\"$body\"}"; }
shitpost(){ getbody; postid=$1; parentid=$2; post "comment" "{\"post_id\":$postid,\"parent_id\":$parentid,\"content\":\"$body\"}"; }
#Post hoardan
save(){ put "post/save" "{\"post_id\":$1,\"save\":true}"; }
unsave(){ put "post/save" "{\"post_id\":$1,\"save\":false}"; }
load(){ getauth "post/list" ".posts | .[] | $postsummary" "type_=All&saved_only=true"; }
#Community hoardan
follow(){ post "community/follow" "{\"community_id\":$1,\"follow\":true}"; }
unfollow(){ post "community/follow" "{\"community_id\":$1,\"follow\":false}"; }
#Account hoardan
whoami(){ echo $INSTANCE $TOKE; }
login(){ post "user/login" "{\"username_or_email\":\"$1\",\"password\":\"$2\"}"; }
#Misc
deref(){ getauth "resolve_object" "" "q=$*"; }