LineBot
Extends:
LINE Bot API wrapper.
Example:
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(config: LineBotConfig) Constructor |
Member Summary
Public Members | ||
public |
Configuration. |
|
public |
Configuration. |
Method Summary
Public Methods | ||
public |
getContent(messageId: string): Promise<stream.Readable, Error> Retrieve image, video, and audio data sent by users. |
|
public |
getContentFromMessage(message: LineMessage): Promise<stream.Readable, Error> Retrieve image, video, and audio data sent by users. |
|
public |
getProfile(userId: string): Promise<LineProfile, Error> Send messages to users, groups, and rooms at any time. |
|
public |
Send messages to users, groups, and rooms at any time. |
|
public |
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 |
Adds a listener to the end of the listeners array for the specified event. |
|
public |
Send messages to users, groups, and rooms at any time. |
Public Constructors
public constructor(config: LineBotConfig) source
Constructor
Params:
Name | Type | Attribute | Description |
config | LineBotConfig |
Public Members
Public Methods
public getContent(messageId: string): Promise<stream.Readable, Error> source
Retrieve image, video, and audio data sent by users.
Params:
Name | Type | Attribute | Description |
messageId | string | Message ID. |
public getContentFromMessage(message: LineMessage): Promise<stream.Readable, Error> source
Retrieve image, video, and audio data sent by users.
Params:
Name | Type | Attribute | Description |
message | LineMessage | Message |
public getProfile(userId: string): Promise<LineProfile, Error> source
Send messages to users, groups, and rooms at any time.
Params:
Name | Type | Attribute | Description |
userId | string | User ID |
public getProfileFromUserSource(user: UserSource): Promise<LineProfile, Error> source
Send messages to users, groups, and rooms at any time.
Params:
Name | Type | Attribute | Description |
user | UserSource | User source |
public leaveFromSource(source: GroupSource | RoomSource): Promise<void, Error> source
Leave a group or room.
Params:
Name | Type | Attribute | Description |
source | GroupSource | RoomSource |
public listen(args: ...any ): http.Server source
Binds and listens for connections on the specified host and port.
Params:
Name | Type | Attribute | Description |
args | ...any |
public on(event: string | string[], listener: Function): LineBot source
Adds a listener to the end of the listeners array for the specified event.
Params:
Name | Type | Attribute | Description |
event | string | string[] | Event name |
|
listener | Function | Listener function |
Listen:
webhook:{eventType} |
Listen message event. https://developers.line.me/bot-api/api-reference#sending_message |