Kiɾʌ Kenjiɾø
Kiɾʌ Kenjiɾø
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 5/10/2024 in #djs-questions
Odd issue with client not being detected.
So I'm running into an issue with a function I made to check the permission of a user in a guild. It says the client is undefined in the permissionHandler.js I'm really not sure why it's happening as it's just been working in other files. (P.s. Github is down for me to idk why I can't up it to a repo)
11 replies
CDCloudflare Developers
Created by Kiɾʌ Kenjiɾø on 2/3/2024 in #general-help
certificate issues. Strict vs Full
I have a website with a strict certificate. When others access it, they don't receive the origin certificate but receive the edge certificate with https. However, when I access it on my network, I get the origin certificate, but the website is flagged as insecure, despite having the origin certificate. Can someone assist me in configuring this? I'm running an Apache server on Ubuntu.
19 replies
CDCloudflare Developers
Created by Kiɾʌ Kenjiɾø on 2/3/2024 in #general-help
SSL Not working for my network but fine for others.
So, I've run into a weird error. Whenever i go to my domain on my computer. Or as a matter of fact, Any device on my network. It says unsecure but if anyone else goes to it they get the full origin Certificate and ssl. Https used. But it's only for my network, When i change my phone to data rather than wifi. It works fine but laptop, computer, phone on network unsecure? Anyuone got any ideas why
1 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 1/28/2024 in #djs-questions
Value undefined after SQL database initiation
const joinMessage = await interaction.channel.send({ embeds: [joinEmbed], components: [row] });

// Defined value
// console.log(joinMessage.id)

const db = await new sqlite3.Database("arg.db");
const updateSql = `
UPDATE System
SET variableName = ?
SET variableData = ?
`;

// Undefined value
// console.log(joinMessage.id)

try {
// Undefined value
await db.run(updateSql, [
"joinMessageId",
joinMessage.id
]);
resolve();
} catch (error) {
reject(error);
}
const joinMessage = await interaction.channel.send({ embeds: [joinEmbed], components: [row] });

// Defined value
// console.log(joinMessage.id)

const db = await new sqlite3.Database("arg.db");
const updateSql = `
UPDATE System
SET variableName = ?
SET variableData = ?
`;

// Undefined value
// console.log(joinMessage.id)

try {
// Undefined value
await db.run(updateSql, [
"joinMessageId",
joinMessage.id
]);
resolve();
} catch (error) {
reject(error);
}
I may be going crazy, But joinMessage.id is undefined anywhere after I open the database. Anyone whose fucked around with sql Is there some reason thats happening?
7 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 1/4/2024 in #djs-questions
Interaction already deferred.
https://github.com/KiraKenjiro/bot The bot at the moment works almost perfectly. qj's been a saviour and helped me with it but i am struggling with once thing. as the model embed is sent, (via clicking on the modalsEmbed button that was sent in the embed command) there is a 5 minute timer that is started. After 5 minutes has elapsed, if the user hasn’t filled in the consent form (checked by ckecing if there is a value in the consent field in the (i think) accounts table). (at the moment it's set to i think 45 seconds just for testing. e.g. 0.45 * 60 * 1000) But when the timer elapsed I got this error. (Provided half log)
[04-01-2024_08-12-24] • Registered Button submitConsent
[04-01-2024_08-12-24] • Registered Button submitDemographics
[04-01-2024_08-12-25] • Accounts table already exists. Skipping.
[04-01-2024_08-12-25] • Demographics table already exists. Skipping.
[04-01-2024_08-12-25] • UserFlags table already exists. Skipping.
[04-01-2024_08-12-25] • UserFlagsDetail table already exists. Skipping.
[04-01-2024_08-12-25] • Database and tables checked/created.
[04-01-2024_08-12-25] • Logged in as bot1184173006159872080#3072
Timer Started
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ButtonInteraction.update (/Users/kirakenjiro/Desktop/bots/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:225:46)
at Timeout._onTimeout (/Users/kirakenjiro/Desktop/bots/buttons/modalsEmbed.js:86:31) {
code: 'InteractionAlreadyReplied'
}
[04-01-2024_08-12-24] • Registered Button submitConsent
[04-01-2024_08-12-24] • Registered Button submitDemographics
[04-01-2024_08-12-25] • Accounts table already exists. Skipping.
[04-01-2024_08-12-25] • Demographics table already exists. Skipping.
[04-01-2024_08-12-25] • UserFlags table already exists. Skipping.
[04-01-2024_08-12-25] • UserFlagsDetail table already exists. Skipping.
[04-01-2024_08-12-25] • Database and tables checked/created.
[04-01-2024_08-12-25] • Logged in as bot1184173006159872080#3072
Timer Started
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ButtonInteraction.update (/Users/kirakenjiro/Desktop/bots/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:225:46)
at Timeout._onTimeout (/Users/kirakenjiro/Desktop/bots/buttons/modalsEmbed.js:86:31) {
code: 'InteractionAlreadyReplied'
}
I think... It's talking about this section of code from lines 81 to 89 in the file modalsEmbed.js (There is an issue where i forgot to update it with the right description but, you get the idea it would update it to something like, oops, form timed out) I'm not entirely too sure whats happening but it may be due to the embed being sent at 102 to 106 as, i have a slight feeling thats the interaction i want to update and im trying to update the interaction before. This is just a guess but i'd love a second opinion on this <3 --- Edit: I'm pretty sure im trying to edit the interaction before the interaction i want to edit. not too sure if thats worded right but alas
6 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 12/31/2023 in #djs-questions
Editing button to be enabled after user completed modal.
Essentially, I have an embedded message featuring three buttons, with two of them currently in a disabled state. When the user completes the first modal, my aim is to activate the second button, deactivate the first button, and, concurrently, upon completion of the second form, enable the consent button while disabling the second button. I don't know if this would be possible due to the interaction timing out but i'd appreciate a second eye. (Yes i am aware that my token is in this repo, As a matter of fact, Idc i'll just reset it.) https://github.com/KiraKenjiro/TempRepo
10 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 12/29/2023 in #djs-questions
Query about Modals
Quick query, I'm using the short style in modals to collect demographic data and I'm not too sure where it is but.
data.components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length.
at handleErrors (C:\Users\kirak\Desktop\ARG\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\kirak\Desktop\ARG\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\kirak\Desktop\ARG\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.showModal (C:\Users\kirak\Desktop\ARG\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:253:5)
at async Object.execute (C:\Users\kirak\Desktop\ARG\buttons\submitCaptcha.js:156:4)
at async Client.<anonymous> (C:\Users\kirak\Desktop\ARG\index.js:125:5) {
requestBody: { files: undefined, json: { type: 9, 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/1190317516082384917/aW50ZXJhY3Rpb246MTE5MDMxNzUxNjA4MjM4NDkxNzp1WlU1ZEdLaWRCa1hzaFdlTHlEVmR1cHgxQXFqbVVqZ3ltcTJTRDdqQ2E1NjF5MlRjeHJwcmtZbEdDQmpIMDJnY1QxY1hVd1cyZ3pxU0JSQWg5YThQVWRzRllDSDc2QkZwRGZUR1psYXhqZ3hnWjhYdTYwOEU0NFhiYUFoSDRGTw/callback'
}
[29-12-2023_15-36-50] • An error has occurred: DiscordAPIError[50035]: Invalid Form Body
data.components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length.
data.components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length.
at handleErrors (C:\Users\kirak\Desktop\ARG\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\kirak\Desktop\ARG\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\kirak\Desktop\ARG\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.showModal (C:\Users\kirak\Desktop\ARG\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:253:5)
at async Object.execute (C:\Users\kirak\Desktop\ARG\buttons\submitCaptcha.js:156:4)
at async Client.<anonymous> (C:\Users\kirak\Desktop\ARG\index.js:125:5) {
requestBody: { files: undefined, json: { type: 9, 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/1190317516082384917/aW50ZXJhY3Rpb246MTE5MDMxNzUxNjA4MjM4NDkxNzp1WlU1ZEdLaWRCa1hzaFdlTHlEVmR1cHgxQXFqbVVqZ3ltcTJTRDdqQ2E1NjF5MlRjeHJwcmtZbEdDQmpIMDJnY1QxY1hVd1cyZ3pxU0JSQWg5YThQVWRzRllDSDc2QkZwRGZUR1psYXhqZ3hnWjhYdTYwOEU0NFhiYUFoSDRGTw/callback'
}
[29-12-2023_15-36-50] • An error has occurred: DiscordAPIError[50035]: Invalid Form Body
data.components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 5 in length.
I'm getting this error Do short style modals have a set length value? I'll provide my code if needed but to keep the chat clean i'll upload it as a txt document
17 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 12/24/2023 in #djs-questions
Adding SubCommand to commands.
I'm using this snippet to load my slash commands.
// Function to register commands from the "./commands" directory
const registerCommands = async () => {
const commandFiles = await fsPromises.readdir("./commands");
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
if (command && command.name) {
client.commands.set(command.name, command);
handlers.logHandler.log(`Registered Command ${command.name}`, 1);
} else {
handlers.logHandler.log(
`Command ${file} is missing data or name property. Skipping.`,
2
);
}
}
};
// Function to register commands from the "./commands" directory
const registerCommands = async () => {
const commandFiles = await fsPromises.readdir("./commands");
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
if (command && command.name) {
client.commands.set(command.name, command);
handlers.logHandler.log(`Registered Command ${command.name}`, 1);
} else {
handlers.logHandler.log(
`Command ${file} is missing data or name property. Skipping.`,
2
);
}
}
};
Here is an example of a command in that ./command file
const handlers = require("../handlerLoader.js");
const { client } = require("../index");

module.exports = {
name: "embed",
description:
"Send a specific embed to the channel you execute this command in.",
async execute(interaction) {
try {
const guild = await client.guilds.fetch(interaction.guild.id);
const member = await guild.members.fetch(interaction.user.id);

const isAdmin = member.permissions.has(PermissionFlagsBits.Administrator);
console.log(isAdmin)
} catch (error) {
console.error(`Error in hasAdminPermissions: ${error}`);
return false;
}
}
};
const handlers = require("../handlerLoader.js");
const { client } = require("../index");

module.exports = {
name: "embed",
description:
"Send a specific embed to the channel you execute this command in.",
async execute(interaction) {
try {
const guild = await client.guilds.fetch(interaction.guild.id);
const member = await guild.members.fetch(interaction.user.id);

const isAdmin = member.permissions.has(PermissionFlagsBits.Administrator);
console.log(isAdmin)
} catch (error) {
console.error(`Error in hasAdminPermissions: ${error}`);
return false;
}
}
};
How would i add a SubCommand and other arguments to that command? I can't figure it out 💜 Also feel free to ping me! :D
8 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 12/5/2023 in #djs-questions
Support with using client in separate files.
No description
15 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 11/16/2023 in #djs-questions
Waiting for user message in DM.
I've been trying to get the bot to wait for a message but it keeps logging this error
TypeError: Cannot read properties of null (reading 'awaitMessages')
at Object.execute (/Users/kirakenjiro/Desktop/Coding/Active/AkedasBot/commands/verify.js:31:61)
at Client.<anonymous> (/Users/kirakenjiro/Desktop/Coding/Active/AkedasBot/index.js:80:19)
at Client.emit (node:events:514:28)
at InteractionCreateAction.handle (/Users/kirakenjiro/node_modules/discord.js/src/client/actions/InteractionCreate.js:97:12)
TypeError: Cannot read properties of null (reading 'awaitMessages')
at Object.execute (/Users/kirakenjiro/Desktop/Coding/Active/AkedasBot/commands/verify.js:31:61)
at Client.<anonymous> (/Users/kirakenjiro/Desktop/Coding/Active/AkedasBot/index.js:80:19)
at Client.emit (node:events:514:28)
at InteractionCreateAction.handle (/Users/kirakenjiro/node_modules/discord.js/src/client/actions/InteractionCreate.js:97:12)
Here is my code.
const { EmbedBuilder } = require("discord.js");
const handlers = require("../handlerLoader.js");

module.exports = {
name: "verify",
description: "Sends your ID to the moderators to be verified for the 18+ channels",

async execute(interaction) {
// Check if the command was sent in a DM channel
if (interaction.guildId) {
// Send an embed indicating that the command must be executed in a DM
const warningEmbed = new EmbedBuilder()
.setColor(0x2b2d31)
.setAuthor({
name: "Verification Error",
})
.setDescription(
'This command must be executed in a DM (Direct Message) channel.\nYour legal ID was not processed.'
);

await interaction.reply({
embeds: [warningEmbed],
ephemeral: true,
});
} else {
// Wait for 30 seconds in the DM
const filter = (msg) => msg.author.id === interaction.user.id;
const options = { max: 1, time: 30000, errors: ["time"] };

try {
const collected = await interaction.channel.awaitMessages(filter, options);
const message = collected.first();

// Check if the message contains an image
if (message && message.attachments.size > 0) {
const imageUrl = message.attachments.first().url;
console.log(`Image URL: ${imageUrl}`);
}
} catch (error) {
console.error(error);
}
}
}
};
const { EmbedBuilder } = require("discord.js");
const handlers = require("../handlerLoader.js");

module.exports = {
name: "verify",
description: "Sends your ID to the moderators to be verified for the 18+ channels",

async execute(interaction) {
// Check if the command was sent in a DM channel
if (interaction.guildId) {
// Send an embed indicating that the command must be executed in a DM
const warningEmbed = new EmbedBuilder()
.setColor(0x2b2d31)
.setAuthor({
name: "Verification Error",
})
.setDescription(
'This command must be executed in a DM (Direct Message) channel.\nYour legal ID was not processed.'
);

await interaction.reply({
embeds: [warningEmbed],
ephemeral: true,
});
} else {
// Wait for 30 seconds in the DM
const filter = (msg) => msg.author.id === interaction.user.id;
const options = { max: 1, time: 30000, errors: ["time"] };

try {
const collected = await interaction.channel.awaitMessages(filter, options);
const message = collected.first();

// Check if the message contains an image
if (message && message.attachments.size > 0) {
const imageUrl = message.attachments.first().url;
console.log(`Image URL: ${imageUrl}`);
}
} catch (error) {
console.error(error);
}
}
}
};
I'd love a few pointers of where im going wrong <3
15 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 10/31/2023 in #djs-questions
TypeError: fs.existsSync is not a function
Could anyone help me with this, I'm a little confused about why it's not working but.
Error while executing 'agree': TypeError: fs.existsSync is not a function
at Object.execute (/Users/kirakenjiro/Desktop/Coding/DiscordBotBoilerPlate/buttons/viewCaptcha.js:18:21)
at async Client.<anonymous> (/Users/kirakenjiro/Desktop/Coding/DiscordBotBoilerPlate/index.js:121:5)
Error while executing 'agree': TypeError: fs.existsSync is not a function
at Object.execute (/Users/kirakenjiro/Desktop/Coding/DiscordBotBoilerPlate/buttons/viewCaptcha.js:18:21)
at async Client.<anonymous> (/Users/kirakenjiro/Desktop/Coding/DiscordBotBoilerPlate/index.js:121:5)
There is the full error, In vieCaptcha.js is this line
// Ensure the JSON file exists
if (!fs.existsSync(jsonFilePath)) {
fs.writeFileSync(jsonFilePath, JSON.stringify({}), "utf-8");
}
// Ensure the JSON file exists
if (!fs.existsSync(jsonFilePath)) {
fs.writeFileSync(jsonFilePath, JSON.stringify({}), "utf-8");
}
Here’s the Git of the full repo. But i just can't figure out why it's not working. https://github.com/KiraKenjiro/Temp
3 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 10/28/2023 in #djs-questions
Removing last embed.
const handlers = require("../handlerLoader.js");
const {
EmbedBuilder,
AttachmentBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} = require("discord.js");
const fs = require("fs");

let lastEphemeralMessageID = null;

module.exports = {
name: "agree",

async execute(interaction) {
if (lastEphemeralMessageID) {
await interaction.deleteReply(lastEphemeralMessageID);
lastEphemeralMessageID = null;
}

const captcha = await handlers.captchaHandler.generateCaptcha(
interaction.user.id
);

if (captcha.exists) {
fs.unlinkSync(captcha.filePath);
} else {
const file = new AttachmentBuilder(captcha.filePath, {
name: "captcha.png",
});
const captchaEmbed = new EmbedBuilder()
.setColor(0x2b2d31)
.setAuthor({
name: "Captcha Code",
})
.setImage(`attachment://${file.name}`);

const submitButton = new ButtonBuilder()
.setCustomId("submitCaptcha")
.setLabel("Submit")
.setStyle(ButtonStyle.Success)
.setEmoji("1144203623849537607");

const row = new ActionRowBuilder().addComponents(submitButton);

const reply = await interaction.reply({
embeds: [captchaEmbed],
files: [file],
components: [row],
ephemeral: true,
});

lastEphemeralMessageID = reply.id;
}
}
};
const handlers = require("../handlerLoader.js");
const {
EmbedBuilder,
AttachmentBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} = require("discord.js");
const fs = require("fs");

let lastEphemeralMessageID = null;

module.exports = {
name: "agree",

async execute(interaction) {
if (lastEphemeralMessageID) {
await interaction.deleteReply(lastEphemeralMessageID);
lastEphemeralMessageID = null;
}

const captcha = await handlers.captchaHandler.generateCaptcha(
interaction.user.id
);

if (captcha.exists) {
fs.unlinkSync(captcha.filePath);
} else {
const file = new AttachmentBuilder(captcha.filePath, {
name: "captcha.png",
});
const captchaEmbed = new EmbedBuilder()
.setColor(0x2b2d31)
.setAuthor({
name: "Captcha Code",
})
.setImage(`attachment://${file.name}`);

const submitButton = new ButtonBuilder()
.setCustomId("submitCaptcha")
.setLabel("Submit")
.setStyle(ButtonStyle.Success)
.setEmoji("1144203623849537607");

const row = new ActionRowBuilder().addComponents(submitButton);

const reply = await interaction.reply({
embeds: [captchaEmbed],
files: [file],
components: [row],
ephemeral: true,
});

lastEphemeralMessageID = reply.id;
}
}
};
So i've got this lil snippet from my bot. What it does is it requests a png image of a captcha code to be made then the function will reply with the image location. It sends an embed empheral and so on. I wanted it so that there can only be one active captcha image per user. And hey ho! It works, Untill i realised that the bot will just.. carry on making embed messages without removing the old ones... I have a lastEphemeralMessageID var, But. I'm not too sure if my code is right as, It's not removing the old ones, And it's just returning an error message so, Just came for some help! xD
5 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 10/27/2023 in #djs-questions
Program can't locate file.
No description
55 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 10/27/2023 in #djs-questions
Attaching local file in embed.
So i'm using this code.
const handlers = require("../handlerLoader.js");
const { EmbedBuilder, MessageAttachment } = require("discord.js");
module.exports = {
name: "agree",

async execute(interaction) {
const captcha = handlers.captchaHandler.generateCaptcha();
const captchaEmbed = new EmbedBuilder()
.setColor(0x2B2D31)
.setAuthor({
name: "Captcha Code",
})
.setImage(captcha.filePath)

await interaction.reply({
embeds: [captchaEmbed],
ephemeral: true,
});
},
};
const handlers = require("../handlerLoader.js");
const { EmbedBuilder, MessageAttachment } = require("discord.js");
module.exports = {
name: "agree",

async execute(interaction) {
const captcha = handlers.captchaHandler.generateCaptcha();
const captchaEmbed = new EmbedBuilder()
.setColor(0x2B2D31)
.setAuthor({
name: "Captcha Code",
})
.setImage(captcha.filePath)

await interaction.reply({
embeds: [captchaEmbed],
ephemeral: true,
});
},
};
The variable captcha.filePath like its name hold the file path to a png image. When the button is clicked this error is passed. Could someone advice me on what i'm doing wrong, Does the .setImage only take URL/URIs?
10 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 10/22/2023 in #djs-questions
API not returning data
https://gist.github.com/KiraKenjiro/de1460359c1b33dc5f2d55763eae95a2 Inside the Gist, there's a bot that retrieves user information based on their ID. The bot command is functional, so if you use "!info {userid}" in a chat, it will provide you with all the relevant information. However, when I attempt to request the API, it doesn't return any data. Data returned by command:
{
userId: '625393879075651584',
userName: 'kirakenjiro',
displayName: 'kirakenjiro',
discriminator: '0',
bannerHexColor: '242428',
avatarURL: 'https://cdn.discordapp.com/avatars/625393879075651584/d53788b4be06a49798665e9684a282ad.webp',
isAnimatedAvatar: false,
bannerURL: 'https://cdn.discordapp.com/banners/625393879075651584/a_c83b90790bdc19f845db9792f96e2ab7.gif',
isAnimatedBanner: true,
accountCreationDate: 1569175920028,
monitoringSince: 1682242323939,
activities: {
'Genshin Impact': {
name: 'Genshin Impact',
details: null,
state: null,
startPlayTimestamp: 1697974047
}
}
{
userId: '625393879075651584',
userName: 'kirakenjiro',
displayName: 'kirakenjiro',
discriminator: '0',
bannerHexColor: '242428',
avatarURL: 'https://cdn.discordapp.com/avatars/625393879075651584/d53788b4be06a49798665e9684a282ad.webp',
isAnimatedAvatar: false,
bannerURL: 'https://cdn.discordapp.com/banners/625393879075651584/a_c83b90790bdc19f845db9792f96e2ab7.gif',
isAnimatedBanner: true,
accountCreationDate: 1569175920028,
monitoringSince: 1682242323939,
activities: {
'Genshin Impact': {
name: 'Genshin Impact',
details: null,
state: null,
startPlayTimestamp: 1697974047
}
}
Data returned by API:
Response from API:
{}
Response from API:
{}
Can anyone help or run your eyes over this to see if i'm doing anything wrong, I can't unpick it xD
20 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 10/22/2023 in #djs-questions
Getting Banner URL
GIST: https://gist.github.com/KiraKenjiro/de1460359c1b33dc5f2d55763eae95a2
let bannerURL = user.bannerURL({ format: "png", dynamic: true });
let isAnimatedBanner = bannerURL && typeof bannerURL === "string" && bannerURL.includes(".gif");
let bannerURL = user.bannerURL({ format: "png", dynamic: true });
let isAnimatedBanner = bannerURL && typeof bannerURL === "string" && bannerURL.includes(".gif");
That code returns this value,
bannerURL: undefined,
isAnimatedBanner: undefined,
bannerURL: undefined,
isAnimatedBanner: undefined,
Is there something i'm doing wrong to get the banner?
10 replies
DIAdiscord.js - Imagine an app
Created by Kiɾʌ Kenjiɾø on 8/30/2023 in #djs-questions
Accessing handle functions globally.
I've been working on creating a Discord boilerplate for myself. One of my goals was to develop a handler function capable of producing a captcha SVG file. This function would not only return the file's location but also the content of the captcha. This could be used for verification and other similar tasks. However, I've discovered a limitation: the handler function can only be used within the index.js file. It seems that this restriction is due to how I've set up the handler registration process in the index.js file. You can find the progress of my boilerplate in this GitHub repository: Github Repo Here's the code snippet where I register the handlers:
handlerFiles.forEach((file) => {
if (file.endsWith(".js")) {
const handlerName = path.basename(file, ".js");
const handlerPath = path.join(handlersDirectory, file);
handlers[handlerName] = require(handlerPath);
}
});
handlerFiles.forEach((file) => {
if (file.endsWith(".js")) {
const handlerName = path.basename(file, ".js");
const handlerPath = path.join(handlersDirectory, file);
handlers[handlerName] = require(handlerPath);
}
});
This registration method limits the usage of handler functions. For instance, I'm able to use the GenerateCaptcha function from generateCaptchaHandler.js in the main.js file. However, I'm unable to employ it in a command.js file due to the registration constraints. I'm a bit uncertain about the approach to enable the handler files for usage throughout the entire program structure. If there are any suggestions or ideas from anyone, I would greatly appreciate the assistance.
11 replies