-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetprofile.js
73 lines (72 loc) · 1.99 KB
/
getprofile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
async function getProfile(event,client,prefix) {
const message=event.message.text
if (message === prefix + "info") {
let userId;
if (event.source.type === "user") {
userId = event.source.userId;
} else if (event.source.type === "group") {
userId = event.source.groupId;
} else if (event.source.type === "room") {
userId = event.source.roomId;
}
const profile = await client.getProfile(userId);
const flexMessage = {
type: "flex",
altText: "User Info",
contents: {
type: "bubble",
hero: {
type: "image",
url: profile.pictureUrl,
size: "full",
aspectRatio: "20:13",
aspectMode: "cover",
action: {
type: "uri",
uri: "http://linecorp.com/",
},
},
body: {
type: "box",
layout: "vertical",
contents: [
{
type: "text",
text: `${profile.displayName}`,
size: "xxl",
weight: "bold",
},
{
type: "text",
text: `User ID: ${event.source.userId}`,
size: "md",
weight: "regular",
},
{
type: "text",
text: `status: ${profile.statusMessage}`,
size: "md",
weight: "regular",
},
],
},
footer: {
type: "box",
layout: "vertical",
contents: [
{
type: "button",
action: {
type: "uri",
label: "Line網站首頁",
uri: `https://line.me/zh-hant/`,
},
},
],
},
},
};
return client.replyMessage(event.replyToken, flexMessage);
}
}
module.exports={getProfile}