Skip to content

Commit

Permalink
chore(canvas): fix errors and miscellaneous things (discordjs#1227)
Browse files Browse the repository at this point in the history
* chore(canvas): Fix errors and miscellaneous things
* chore: Always error on trailing spaces
  • Loading branch information
Jiralite authored Aug 14, 2022
1 parent cfd5ad6 commit 256ccda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ module.exports = {
rules: {
indent: ['error', 'tab'],
semi: ['error', 'always'],
'no-trailing-spaces': 'error',
},
};
10 changes: 5 additions & 5 deletions guide/popular-topics/canvas.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ const { request } = require('undici');
client.on('interactionCreate', async interaction => {
// ...
context.strokeRect(0, 0, canvas.width, canvas.height);
// using undici to make http requests for better performance

// Using undici to make HTTP requests for better performance
const { body } = await request(interaction.user.displayAvatarURL({ extension: 'jpg' }));
const avatar = await Canvas.loadImage(await body.arrayBuffer());
// if you don't care about the performance of http requests, you can instead load the avatar using

// If you don't care about the performance of HTTP requests, you can instead load the avatar using
// const avatar = await Canvas.loadImage(interaction.user.displayAvatarURL({ extension: 'jpg' }));

// Draw a shape onto the main canvas
context.drawImage(avatar, 25, 0, 200, canvas.height);
// ...
Expand Down

0 comments on commit 256ccda

Please sign in to comment.