twitter client go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
syui a1d84f1ace
add pr comment diff tree
11 months ago
.github/workflows add pr comment diff tree 11 months ago
account update cliv2 3 years ago
bin add script 1 year ago
cmd update v0.4.5, add img upload 1 year ago
color update cliv2 3 years ago
config update cliv2 3 years ago
del add delete tweet 1 year ago
fav update v0.4.1, add fav + retweet 1 year ago
icon update 0.4.6 11 months ago
img fix img 1 year ago
mention update 0.4.6 11 months ago
mm add mention 1 year ago
notify update 0.4.6 11 months ago
o update cliv2 3 years ago
oauth update cliv2 3 years ago
path update cliv2 3 years ago
post update cliv2 3 years ago
ret update v0.4.1, add fav + retweet 1 year ago
search update cliv2 3 years ago
stream update cliv2 3 years ago
timeline update cliv2 3 years ago
user update 0.4.6 11 months ago
.gitignore add actions 1 year ago
.travis.yml fix option/none 3 years ago
PKGBUILD update cliv2 3 years ago
aur.zsh fix option/none 3 years ago
build.zsh travis 3 years ago
config.json.example update cliv2 3 years ago
go.mod add mention 1 year ago
readme.md update v0.4.5, add img upload 1 year ago
twg.go update 0.4.6 11 months ago

readme.md

twg

twitter client (golang)

  • 0.3 change key, cannot use the 0.1 ~ 0.2 twitter key.

download

releases

Download the binary and place it where the path passes.

$ go get -u -v github.com/syui/twg

# archlinux
$ curl -SLO https://github.com/syui/twg/releases/download/pre-release/linux_amd64_twg
$ mv linux_amd64_twg twg
$ chmod +x twg
$ echo $GOPATH
$ mv twg $GOPATH/bin

$ which twg

use

# If authentication does not exist, open the browser.
$ twg o

# timeline
$ twg

# help
$ twg h

# post
$ twg p "send tweet"

# user timeline
$ twg u syui__
$ twg u

# stream
$ twg s

# oauth
$ twg o

# search
$ twg / "#twitter" 2

build

If you do not use the releases version, you will need consumer_key etc.

config.json : https://apps.twitter.com/

# go get -u -v github.com/syui/twg
$ go get -v github.com/syui/twg
$ cd $GOPATH/src/!$
$ cp ./config.json.example config.json
$ vim config.json
$ export CKEY=`cat ./config.json| jq -r ".consumer_key"`
$ export CSKEY=`cat ./config.json| jq -r ".consumer_secret"`
$ go build -ldflags="-X github.com/syui/twg/oauth.ckey=$CKEY -X github.com/syui/twg/oauth.cskey=$CSKEY"

help

# command sub help
$ twg stream help

test func 2

Create a setting file and load the settings as needed. This function is currently being tested.

Setting is the setting of icon display effective only with mac: iTerm. Below, we will show you how to switch ON / OFF function and how to use it.

# iterm-mode : enable
$ twg set help
$ twg set true
$ twg t

# iterm-mode : disable
$ twg set false
$ twg t

# Check ON / OFF of function
$ twg set c
iterm-mode/check false

Delete `~ /.config/twg/img` if the picture icon is wrong. It will be reacquired when it becomes necessary
$ twg set d

If you use tmux, you may not be able to display it properly. If the terminal is disturbed, you can modify it with reset command.

test func 3

This is a test function.

A command related to acquisition of user information was added.

# Acquire three latest notifications
$ twg n 3

test func 4

# Acquire three latest user timeline
$ twg u syui__ 3

config file

~/.config/twg/verify.json : twg_icon

https://api.twitter.com/1.1/account/verify_credentials.json

type json

$ cat ~/.config/twg/verify.json | jq . | gojson

v 0.4.0

# mention, reply
$ twg m | peco | awk -F ' ' '{print $NF}'
123456789
# warning : replies to others need to be marked with @user.
$ twg mm 123456789 "@user $message"
or
$ twg m | peco | awk -F ' ' '{print $NF}' | xargs -I {} twg mm {} "$message"

v 0.4.1

## fav
$ twg m
123456789
$ twg f $tweet_id
or
$ twg m | peco | awk -F ' ' '{print $(NF -1)}' | xargs -I {} twg f {}

## retweet
$ twg r $tweet_id

v 0.4.2

# tweet id user post
$ twg m u

# tweet id notify(mention)
$ twg m n

# tweet id timeline 
$ twg m t

v 0.4.3

$ twg m t 100

$ ./bin/twg-mention-peco.zsh 100

v 0.4.4

# delete tweet
$ twg u syui__ 100 | awk -f ' ' '{print $(nf -1)}'
123456789

$ twg d 123456789

if there is a line break, use C+space in peco to select it.

v 0.4.5

$ sudo pacman -S libsixel
$ img2sixel ~/file/img.jpg

# image tweet
$ twg i ~/file/img.jpg "$message"

https://github.com/syui/twg

https://aur.archlinux.org/packages/twg

$ sha1sum ./linux_386_twg ./linux_amd64_twg >> PKGBUILD
$ vim PKGBUILD
$ makepkg --printsrcinfo > .SRCINFO

ref

https://github.com/mrjones/oauth/blob/master/examples/twitter/twitter.go