質問編集履歴
1
getMessageContentを使用した
test
CHANGED
File without changes
|
test
CHANGED
@@ -105,3 +105,49 @@
|
|
105
105
|
console.log(`Server running at ${PORT}`);
|
106
106
|
|
107
107
|
```
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
(追記)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
getMessageContentを使用して以下のように★付近のコードを変更しました。
|
120
|
+
|
121
|
+
```python
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
if (event.message.type == "image"){
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
return client.getMessageContent(event.message.id).then((stream) => {
|
130
|
+
|
131
|
+
stream.on('data', (chunk) => {
|
132
|
+
|
133
|
+
//console.log(chunk);
|
134
|
+
|
135
|
+
fs.writeFile("./out/test.jpg",chunk,"binary",(error)=>{
|
136
|
+
|
137
|
+
if(error){
|
138
|
+
|
139
|
+
console.log("error");
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
})
|
144
|
+
|
145
|
+
})
|
146
|
+
|
147
|
+
})
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
```
|