我只想用nodejs 下载我的电报机器人收到的图像,但我不知道要使用的女巫方法。我正在使用node-telegram-bot-api并尝试了这段代码:
bot.on('message', (msg) => {
const img = bot.getFileLink(msg.photo[0].file_id);
console.log(img);
});
Run Code Online (Sandbox Code Playgroud)
这就是结果:
Promise [Object] {
_bitField: 0,
_fulfillmentHandler0: undefined,
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined,
_cancellationParent:
Promise [Object] {
_bitField: 1,
_fulfillmentHandler0: [Function],
_rejectionHandler0: undefined,
_promise0: [Circular],
_receiver0: undefined,
_cancellationParent:
Promise [Object] {
_bitField: 1,
_fulfillmentHandler0: undefined,
_rejectionHandler0: [Function],
_promise0: [Circular],
_receiver0: undefined,
_cancellationParent: [Promise],
_branchesRemainingToCancel: 1 },
_branchesRemainingToCancel: 1 } }
Run Code Online (Sandbox Code Playgroud) 我正在开发一个Laravel 8在后端和Nuxtjs前端使用的应用程序。Axios我的问题是,每次我使用任何方法发出请求时,Laravel 都会创建一个新会话。例如,这会阻止我检查 csrf cookie,因为每次都会生成一个新会话。我真的不知道该怎么办,我想得到你的帮助......
获取会话令牌的示例代码:
Route::get('/test', function() {
return request()->session()->token();
});
Run Code Online (Sandbox Code Playgroud)
第一次尝试:IM23wUv9NTY2IUu9gAJix6TTg3IFjjgOkasOkRhn
第二次尝试:bMpuaa9Ink4dOUUJNEyJnbYYKSqSACP216Xq08Uh
因此,我的每个请求总是得到 419。
代码:
const self = this
const rootURL = self.$axios.defaults.baseURL.replace('/api', '')
self.$axios.get('/sanctum/csrf-cookie', {
baseURL: rootURL
}).then(() => {
self.$axios.post('/auth/login', {
email: self.email,
password: self.password,
}, {withCredentials: true}).then(({data: response}) => {
console.log(response)
})
})
Run Code Online (Sandbox Code Playgroud)
回复:
{
"message": "CSRF token mismatch.",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\HttpException",
"file": "/home/sidik/Projets/Colisone/web/laravel-backend/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
"line": 387,
"trace": [
{
"file": "/home/sidik/Projets/Colisone/web/laravel-backend/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
"line": 332,
"function": "prepareException",
"class": "Illuminate\\Foundation\\Exceptions\\Handler",
"type": "->"
}, …Run Code Online (Sandbox Code Playgroud)