lineatgo

package module
v0.0.0-...-1055e9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2021 License: MIT Imports: 23 Imported by: 0

README

GoDoc GoWalker MIT License

lineatgo

This is an unofficial LINE@ SDK that was implemented in pure go

This project is no longer maintained

This will be not maintained because of my motivation. If you send me some pull request, perhaps it affect my motivation.

Particular Requirement

  • ChromeDriver

installation

package

go get github.com/s3pt3mb3r/lineatgo

ChromeDriver

for homebrew user

brew install chromedriver

for windows user Download link

Usage

package main

import (
    "github.com/s3pt3mb3r/lineatgo"
    "log"
    "fmt"
    "os"
)

func main()  {
    api := lineatgo.NewApi("MAIL_ADDRESS", "PASSWORD")
    bot, err := api.NewBot("@LINEID")
    if err != nil {
        log.Println(err)
    }

    //post
    p := bot.NewPost()
    p.Add("text", "This", " is", " a")
	p.Add("text", "test")
	p.Add("image", "/Path/To/photo.jpg", "/Path/To/photo2.jpg", "Path/To/video.mp4")
    p.Post()
    
    //you can get a auth URL
    url := bot.GetAuthURL(lineatgo.Administrator)
    //else: lineatgo.Operator, lineatgo.LimitedOperator, lineatgo.Messenger
    fmt.Println(url)

    //You can get your QR code
    qr := bot.GetQRCode()

    file, err := os.OpenFile("test.png", os.O_RDWR|os.O_CREATE, 0666)
    if err != nil {
        log.Fatal(err)
    }
    defer file.Close()
    file.Write(qr)
}

What is "@LINEID"?

lineId

Todo

  • Enable to select authority type in getAuth function
  • Enable to Delete paymaster user's clearance
  • Enable to Post some text on time line
  • Enable to Post image or video on time line
  • Fix DeletePostAll function
At last

Probably, being overlook some factors, I can't code Login() function without web driver (I'm working at dev branch. See login2 function)

If it's possible, please make Login() function more better and send pull request:)

Documentation

Index

Constants

View Source
const (
	Administrator   = "ADMIN"
	Operator        = "OPERATOR"
	LimitedOperator = "OPERATOR_LIMITED"
	Messenger       = "MESSENGER"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	// contains filtered or unexported fields
}

func NewApi

func NewApi(mail, pass string) *Api

NewApi creates a new api.

func (*Api) NewBot

func (a *Api) NewBot(lineId string) (Bot, error)

NewBot creates a new bot.

type AuthUser

type AuthUser struct {
	Name string

	IsPaymaster   bool
	AuthorityType string
	*Api
	// contains filtered or unexported fields
}

func (*AuthUser) Delete

func (u *AuthUser) Delete() error

DeleteAuthUser purges user from bot

func (AuthUser) SetPaymaster

func (u AuthUser) SetPaymaster()

SetPaymaster changes payer for this bot

type AuthUserList

type AuthUserList struct {
	Users []AuthUser
}

type Bot

type Bot struct {
	Name   string
	LineId string
	BotId  string
	*Api
	AuthUserList *AuthUserList
}

func (*Bot) DeleteBot

func (b *Bot) DeleteBot()

DeleteBot eliminates itself

func (*Bot) DeletePostAll

func (b *Bot) DeletePostAll()

DeletePostAll deletes all of post the account has.

func (*Bot) GetAuthURL

func (b *Bot) GetAuthURL(role string) string

GetAuthURL retrieves a url to enable access the account.

func (b *Bot) GetFriendLink() string

GetFriendLink gets "LINE Add Link".

func (*Bot) GetQRCode

func (b *Bot) GetQRCode() []byte

GetQRCode gets qr code as byte slice

func (*Bot) NewPost

func (b *Bot) NewPost() *Post

NewPost initialize post struct which can be added component

func (*Bot) SetName

func (b *Bot) SetName(newName string)

SetName names bot

func (*Bot) SetStatusMessage

func (b *Bot) SetStatusMessage(newStatusMessage string)

SetStatusMessage set status message(IOW hitokoto)

type Post

type Post struct {
	Images []string
	Text   string
	*Api
	*Bot
}

func (*Post) Add

func (p *Post) Add(category string, content ...string)

Add add post component, like text or images

func (*Post) Post

func (p *Post) Post()

Post makes it possible to post composed of text and images(photos videos)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL