服务器响应 403
Server responded with 403
我在启动代码时收到此错误消息:UnhandledPromiseRejectionWarning: Error: Server responded with 403
我该如何解决?
我的代码:
client.on('guildMemberAdd', async (member, guild) => {
const leftright = 147;
const upkdown = 138;
const ksize = 240;
const namleftright04 = 310;
const namupdown14 = 155;
let textsize = 25;
const canvas = Canvas.createCanvas(705,290);
const ctx = canvas.getContext('2d');
const WelcomeImage = await Canvas.loadImage("./image.png");
ctx.drawImage(WelcomeImage, 0, 0, canvas.width, canvas.height);
ctx.font = `${textsize}px px Arial`;
ctx.shadowColor = 'rgba(22, 22, 22, 1)';
ctx.shadowOffsetY = 1;
ctx.shadowBlur = 1;
ctx.fillStyle = 'WHITE';
ctx.fillText(member.user.username, namleftright04, namupdown14);
ctx.beginPath();
ctx.arc(leftright, upkdown, ksize/2, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const avatarUser = await Canvas.loadImage(
member.user.avatarURL({ format: 'jpg' })
);
ctx.drawImage(
avatarUser,
leftright - 120,
upkdown - 120,
ksize,
ksize
)
const attachment = new Discord.MessageAttachment(
canvas.toBuffer(),
'welcome.png'
);
const channel = member.guild.channels.cache.find(ch => ch.id == '870381834624700447');
channel.send(attachment);
});
我收到这个错误:
(node:11608) UnhandledPromiseRejectionWarning: Error: Server responded with 403
at C:\Users\user\Desktop\make\node_modules\canvas\lib\image.js:56:28
at C:\Users\user\Desktop\make\node_modules\simple-get\index.js:89:7
at IncomingMessage.<anonymous> (C:\Users\user\Desktop\make\node_modules\simple-concat\index.js:8:13)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit
也许可以看看 Discord Developers 官方服务器上的这个公告。
我在启动代码时收到此错误消息:UnhandledPromiseRejectionWarning: Error: Server responded with 403
我该如何解决?
我的代码:
client.on('guildMemberAdd', async (member, guild) => {
const leftright = 147;
const upkdown = 138;
const ksize = 240;
const namleftright04 = 310;
const namupdown14 = 155;
let textsize = 25;
const canvas = Canvas.createCanvas(705,290);
const ctx = canvas.getContext('2d');
const WelcomeImage = await Canvas.loadImage("./image.png");
ctx.drawImage(WelcomeImage, 0, 0, canvas.width, canvas.height);
ctx.font = `${textsize}px px Arial`;
ctx.shadowColor = 'rgba(22, 22, 22, 1)';
ctx.shadowOffsetY = 1;
ctx.shadowBlur = 1;
ctx.fillStyle = 'WHITE';
ctx.fillText(member.user.username, namleftright04, namupdown14);
ctx.beginPath();
ctx.arc(leftright, upkdown, ksize/2, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const avatarUser = await Canvas.loadImage(
member.user.avatarURL({ format: 'jpg' })
);
ctx.drawImage(
avatarUser,
leftright - 120,
upkdown - 120,
ksize,
ksize
)
const attachment = new Discord.MessageAttachment(
canvas.toBuffer(),
'welcome.png'
);
const channel = member.guild.channels.cache.find(ch => ch.id == '870381834624700447');
channel.send(attachment);
});
我收到这个错误:
(node:11608) UnhandledPromiseRejectionWarning: Error: Server responded with 403
at C:\Users\user\Desktop\make\node_modules\canvas\lib\image.js:56:28
at C:\Users\user\Desktop\make\node_modules\simple-get\index.js:89:7
at IncomingMessage.<anonymous> (C:\Users\user\Desktop\make\node_modules\simple-concat\index.js:8:13)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit
也许可以看看 Discord Developers 官方服务器上的这个公告。