Home Manual Reference Source Repository
import {LineBot} from '@3846masa/linebot/lib/LineBot'
public class | source

LineBot

Extends:

EventEmitter2 → LineBot

LINE Bot API wrapper.

See:

Example:

EventEmitter
import { LineBot } from '@3846masa/linebot';
const bot = new LineBot(configs);

bot.on('message', (result) => {
  console.log('You got a message!', result);
});

bot.listen(3000);

Constructor Summary

Public Constructor
public

Constructor

Member Summary

Public Members
public

Configuration.

public

Configuration.

Method Summary

Public Methods
public

Retrieve image, video, and audio data sent by users.

public

Retrieve image, video, and audio data sent by users.

public

Send messages to users, groups, and rooms at any time.

public

Send messages to users, groups, and rooms at any time.

public

leave(type: string, id: string): Promise<void, Error>

Leave a group or room.

public

leaveFromSource(source: GroupSource | RoomSource): Promise<void, Error>

Leave a group or room.

public

listen(args: ...any ): http.Server

Binds and listens for connections on the specified host and port.

public

on(event: string | string[], listener: Function): LineBot

Adds a listener to the end of the listeners array for the specified event.

public

push(to: string, msg: LineMessage[] | LineMessage | any): Promise<void, Error>

Send messages to users, groups, and rooms at any time.

Public Constructors

public constructor(config: LineBotConfig) source

Constructor

Params:

NameTypeAttributeDescription
config LineBotConfig

Public Members

public config: LineBotConfig source

Configuration.

public express: Express.Application source

Configuration.

Public Methods

public getContent(messageId: string): Promise<stream.Readable, Error> source

Retrieve image, video, and audio data sent by users.

Params:

NameTypeAttributeDescription
messageId string

Message ID.

See:

public getContentFromMessage(message: LineMessage): Promise<stream.Readable, Error> source

Retrieve image, video, and audio data sent by users.

Params:

NameTypeAttributeDescription
message LineMessage

Message

See:

public getProfile(userId: string): Promise<LineProfile, Error> source

Send messages to users, groups, and rooms at any time.

Params:

NameTypeAttributeDescription
userId string

User ID

See:

public getProfileFromUserSource(user: UserSource): Promise<LineProfile, Error> source

Send messages to users, groups, and rooms at any time.

Params:

NameTypeAttributeDescription
user UserSource

User source

See:

public leave(type: string, id: string): Promise<void, Error> source

Leave a group or room.

Params:

NameTypeAttributeDescription
type string
id string

Return:

Promise<void, Error>

See:

public leaveFromSource(source: GroupSource | RoomSource): Promise<void, Error> source

Leave a group or room.

Params:

NameTypeAttributeDescription
source GroupSource | RoomSource

Return:

Promise<void, Error>

See:

public listen(args: ...any ): http.Server source

Binds and listens for connections on the specified host and port.

Params:

NameTypeAttributeDescription
args ...any

http://expressjs.com/en/4x/api.html#app.listen

Return:

http.Server

See:

public on(event: string | string[], listener: Function): LineBot source

Adds a listener to the end of the listeners array for the specified event.

Params:

NameTypeAttributeDescription
event string | string[]

Event name

listener Function

Listener function

Return:

LineBot

Listen:

webhook:{eventType}

Listen message event. https://developers.line.me/bot-api/api-reference#sending_message

See:

public push(to: string, msg: LineMessage[] | LineMessage | any): Promise<void, Error> source

Send messages to users, groups, and rooms at any time.

Params:

NameTypeAttributeDescription
to string

ID of the receiver

msg LineMessage[] | LineMessage | any

Messages (Max: 5)

Return:

Promise<void, Error>

See: