m1ntyx
m1ntyx
DIAdiscord.js - Imagine an app
Created by m1ntyx on 4/23/2024 in #djs-questions
Canvas change image color
How to change image color, so i load an image of icon i need, and i have function that finds what icon through db. But main thing, the icon images are stored in folder in white color. I want to make multiple colors but then i have to save 100+ images in that folder. So, i need to somehow make it so canvas will change image color. Maybe by a shape and then blend it in image or something, i dont know. Code for function:
async function drawAchievementImage(ctx, achievementName, x, y, width, height) {
const imagePath = getAchievementImagePath(achievementName);
if (imagePath) {
try {
const achievementImage = await Canvas.loadImage(imagePath);
ctx.drawImage(achievementImage, x, y, width, height);
} catch (error) {
console.error(`Error loading image for ${achievementName}:`, error);
}
}
}
async function drawAchievementImage(ctx, achievementName, x, y, width, height) {
const imagePath = getAchievementImagePath(achievementName);
if (imagePath) {
try {
const achievementImage = await Canvas.loadImage(imagePath);
ctx.drawImage(achievementImage, x, y, width, height);
} catch (error) {
console.error(`Error loading image for ${achievementName}:`, error);
}
}
}
4 replies
DIAdiscord.js - Imagine an app
Created by m1ntyx on 3/16/2024 in #djs-questions
Animated bot banner
How to set animated banner on discord bot? Ik its through api, but how?
4 replies
DIAdiscord.js - Imagine an app
Created by m1ntyx on 10/23/2023 in #djs-questions
How to handle commands, json database on public bot
Hello there, how do i make public bot and handling their commands and json config file, maybe in json formation could be for balance: interactionguildid_balance_userid: "500". Send a guide maybe please
3 replies
DIAdiscord.js - Imagine an app
Created by m1ntyx on 8/30/2023 in #djs-questions
Interaction Failed, buttons are not working
https://srcb.in/1UpGBbIlfM buttons are not working, interaction failed. But select menu works
19 replies
DIAdiscord.js - Imagine an app
Created by m1ntyx on 8/29/2023 in #djs-questions
DiscordAPIError[50035]: Invalid Form Body
Code - https://srcb.in/BPUgexv8SV
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[2].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component custom id cannot be duplicated
at handleErrors (C:\Users\fista\Downloads\Nightmess\node_modules\@discordjs\rest\dist\index.js:640:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async BurstHandler.runRequest (C:\Users\fista\Downloads\Nightmess\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\fista\Downloads\Nightmess\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.reply (C:\Users\fista\Downloads\Nightmess\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\fista\Downloads\Nightmess\src\commands\Economy\shop.js:139:21)
at async Object.execute (C:\Users\fista\Downloads\Nightmess\src\events\interactionCreate.js:29:7) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { data: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1146172365726810172/aW50ZXJhY3Rpb246MTE0NjE3MjM2NTcyNjgxMDE3MjpuRk96SzNHTnBCaEpnMmI1TndlcW1PTzRLeU1xczdZa2dCUGl6WGdtS0c1NkY0ZlVNdU1GaHlmVFZmVnREUndHQ0F3NldhN1JzNDc4azBBNDU4NzVpRWVMYTR2Slc2S0FVMDl6U1g4REI2UkJQMktaMkVLWUJBd0w5bkN5a1NGaA/callback'
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[2].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component custom id cannot be duplicated
at handleErrors (C:\Users\fista\Downloads\Nightmess\node_modules\@discordjs\rest\dist\index.js:640:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async BurstHandler.runRequest (C:\Users\fista\Downloads\Nightmess\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\fista\Downloads\Nightmess\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ChatInputCommandInteraction.reply (C:\Users\fista\Downloads\Nightmess\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\fista\Downloads\Nightmess\src\commands\Economy\shop.js:139:21)
at async Object.execute (C:\Users\fista\Downloads\Nightmess\src\events\interactionCreate.js:29:7) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { data: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1146172365726810172/aW50ZXJhY3Rpb246MTE0NjE3MjM2NTcyNjgxMDE3MjpuRk96SzNHTnBCaEpnMmI1TndlcW1PTzRLeU1xczdZa2dCUGl6WGdtS0c1NkY0ZlVNdU1GaHlmVFZmVnREUndHQ0F3NldhN1JzNDc4azBBNDU4NzVpRWVMYTR2Slc2S0FVMDl6U1g4REI2UkJQMktaMkVLWUJBd0w5bkN5a1NGaA/callback'
3 replies