ImMrBloo
ImMrBloo
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
case 'add': {
// Logic for add command
const name = interaction.options.getString('name');
const role = interaction.options.getRole('role') || undefined;
const branch = interaction.options.getString('branch');


if (!name || !branch) {
return Reply(interaction, 'Error: Missing required parameters.', true);
}

const embedOptions = {
title: `Gilded Phoenix Clan Management`,
fields: [
{name: `Clan Name`,value: name.toString(), inline:true},
{name: `Branch`,value: branch.toString(), inline:true},
{name: 'Role', value: role === undefined ? 'undefined' : role.toString(), inline: true}
],
color: '#3b561d',
footer: `gilded Phoenix Clan Management`
}
const embed = createEmbed(embedOptions);

const buttons = ConfirmationButtons('clan_add_yes','clan_add_no')

const msg = await interaction.reply({embeds: [embed], ephemeral: true, components: [buttons], fetchReply: true});
case 'add': {
// Logic for add command
const name = interaction.options.getString('name');
const role = interaction.options.getRole('role') || undefined;
const branch = interaction.options.getString('branch');


if (!name || !branch) {
return Reply(interaction, 'Error: Missing required parameters.', true);
}

const embedOptions = {
title: `Gilded Phoenix Clan Management`,
fields: [
{name: `Clan Name`,value: name.toString(), inline:true},
{name: `Branch`,value: branch.toString(), inline:true},
{name: 'Role', value: role === undefined ? 'undefined' : role.toString(), inline: true}
],
color: '#3b561d',
footer: `gilded Phoenix Clan Management`
}
const embed = createEmbed(embedOptions);

const buttons = ConfirmationButtons('clan_add_yes','clan_add_no')

const msg = await interaction.reply({embeds: [embed], ephemeral: true, components: [buttons], fetchReply: true});
the last line is line 88 where it says the unknown interaction is coming from, and yet it still posts the embed anyway??
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\mattw\OneDrive\Desktop\super\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\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (C:\Users\mattw\OneDrive\Desktop\super\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\mattw\OneDrive\Desktop\super\src\modules\clans\slashCommands\clans.js:88:32)
at async module.exports (C:\Users\mattw\OneDrive\Desktop\super\src\framework\events\interactionCreate.js:10:17) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1202987468937498655/aW50ZXJhY3Rpb246MTIwMjk4NzQ2ODkzNzQ5ODY1NTpHMlJWM01uQ3NPckgzVmtCV3pxekNISnExbkFjYm42clBjNmh6YWw1eDE1ZEY5WHpmUDJhZTl4OE94ZHVHeGY5RGpXVzlzNGViTzhjTDJOZExpUFJhbDBPaXdxdlMzM2MyOVhmZWI1cHBSRnFGOUJ1SmZRY1J6TnRhRUg5OFNxNg/callback'
}
DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\mattw\OneDrive\Desktop\super\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\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\mattw\OneDrive\Desktop\super\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (C:\Users\mattw\OneDrive\Desktop\super\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\mattw\OneDrive\Desktop\super\src\modules\clans\slashCommands\clans.js:88:32)
at async module.exports (C:\Users\mattw\OneDrive\Desktop\super\src\framework\events\interactionCreate.js:10:17) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1202987468937498655/aW50ZXJhY3Rpb246MTIwMjk4NzQ2ODkzNzQ5ODY1NTpHMlJWM01uQ3NPckgzVmtCV3pxekNISnExbkFjYm42clBjNmh6YWw1eDE1ZEY5WHpmUDJhZTl4OE94ZHVHeGY5RGpXVzlzNGViTzhjTDJOZExpUFJhbDBPaXdxdlMzM2MyOVhmZWI1cHBSRnFGOUJ1SmZRY1J6TnRhRUg5OFNxNg/callback'
}
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
Here's another one
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
anyone got an idea?
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
othertimes I get an error that says the interaction was already responded without anything happening or being touched in fact when that error comes I'm still putting inputs into the slash command and it was never even entered
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
it's a collection and it sometimes shows up and othertimes a cached version of it shows up from before I cleared the db
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
Is that was is causing the error?
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
this error only started yesterday I have no clue what's changed or anything
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
The Database it's reading:
[
{
name: 'gladiators legion',
role: '1706830752709',
branch: undefined,
member: '411886883983982593',
invisible: false
}
]
[
{
name: 'gladiators legion',
role: '1706830752709',
branch: undefined,
member: '411886883983982593',
invisible: false
}
]
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
async function clanAutocomplete(interaction) {
// Get the full option list
const { client: { clans} } = interaction;
// Retrieve the current search input
const focusedValue = interaction.options.getFocused();
// Filter the option list
const filtered = clans.filter(clan => clan.name.startsWith(focusedValue));
// Return the filtered list
await interaction.respond(
filtered.map(choice => ({name: choice.name, value: choice.role })),
)
}
async function clanAutocomplete(interaction) {
// Get the full option list
const { client: { clans} } = interaction;
// Retrieve the current search input
const focusedValue = interaction.options.getFocused();
// Filter the option list
const filtered = clans.filter(clan => clan.name.startsWith(focusedValue));
// Return the filtered list
await interaction.respond(
filtered.map(choice => ({name: choice.name, value: choice.role })),
)
}
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 2/2/2024 in #djs-questions
Error Code I can't seem to figure out
async autocomplete(interaction) {
try {
const optionName = interaction.options._hoistedOptions.find(option => option.focused === true).name;
console.log(optionName)
switch (optionName) {
case "branch":
await branchAutocomplete(interaction);
break;
case "clan":
await clanAutocomplete(interaction)
break;
default:
console.log(`Unrecognized option ${interaction.options._hoistedOptions} in subcommand ${interaction.options._subcommand}`);
break;
}
} catch (error) {
console.log(error);
}
}
async autocomplete(interaction) {
try {
const optionName = interaction.options._hoistedOptions.find(option => option.focused === true).name;
console.log(optionName)
switch (optionName) {
case "branch":
await branchAutocomplete(interaction);
break;
case "clan":
await clanAutocomplete(interaction)
break;
default:
console.log(`Unrecognized option ${interaction.options._hoistedOptions} in subcommand ${interaction.options._subcommand}`);
break;
}
} catch (error) {
console.log(error);
}
}
14 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 7/31/2023 in #djs-questions
Slash command not executing
totally forgot to put it in. Got it working now. Thanks ❤️
4 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 7/31/2023 in #djs-questions
Slash command not executing
does any of this make sense why it wouldn't execute? I've tried console logging in a few different places and I've yet to get it to trigger. The slash commands are registering though.
4 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 7/25/2022 in #djs-questions
Audit Log Trouble
yeah that's what I was thinking so I'm trying to think if I can just filter for the class name being inside it than I might be able to have all of the proper information. Do you have any idea how that would be done or even the slightest direction to point?
10 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 7/25/2022 in #djs-questions
Audit Log Trouble
'1001003196912779294' => GuildAuditLogsEntry {
targetType: 'Message',
actionType: 'Delete',
action: 72,
reason: null,
executor: User {
id: '411886883983982593',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'ImMrBloo',
discriminator: '2292',
avatar: '4d8c64a8f4fae3b987701e8315013941',
banner: undefined,
accentColor: undefined
},
changes: [],
id: '1001003196912779294',
extra: {
channel: [TextChannel],
count: 1
},
target: ClientUser {
id: '992650146368196660',
bot: true,
system: false,
flags: [UserFlagsBitField],
username: 'Moon18',
discriminator: '0568',
avatar: 'ac83a5815baf8e75dbba79398ee529e4',
banner: undefined,
accentColor: undefined,
verified: true,
mfaEnabled: true
}
}
'1001003196912779294' => GuildAuditLogsEntry {
targetType: 'Message',
actionType: 'Delete',
action: 72,
reason: null,
executor: User {
id: '411886883983982593',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'ImMrBloo',
discriminator: '2292',
avatar: '4d8c64a8f4fae3b987701e8315013941',
banner: undefined,
accentColor: undefined
},
changes: [],
id: '1001003196912779294',
extra: {
channel: [TextChannel],
count: 1
},
target: ClientUser {
id: '992650146368196660',
bot: true,
system: false,
flags: [UserFlagsBitField],
username: 'Moon18',
discriminator: '0568',
avatar: 'ac83a5815baf8e75dbba79398ee529e4',
banner: undefined,
accentColor: undefined,
verified: true,
mfaEnabled: true
}
}
Just wondering what is this called where it says => "GuildAuditLogsEntry" ? as in when searching through the audit log itself what would I need to do to filter for that?
10 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 7/25/2022 in #djs-questions
Audit Log Trouble
Hey! I'm currently working on version 14 and I'm having an issue with the GuildAuditLogsEntry. I was wondering if I could get an explanation as to what's specifically going on here?
Collection(2) [Map] {
'993275405274468524' => {
targetType: 'Channel',
actionType: 'Create',
action: 10,
reason: null,
executor: '743378368031883337',
changes: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
id: '993275405274468524',
extra: null,
target: '993275405274468523',
createdTimestamp: 1656885710782
},
'1000855284966760491' => GuildAuditLogsEntry {
targetType: 'Channel',
actionType: 'Create',
action: 10,
reason: null,
executor: User {
id: '411886883983982593',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'ImMrBloo',
discriminator: '2292',
avatar: '4d8c64a8f4fae3b987701e8315013941',
banner: undefined,
accentColor: undefined
},
changes: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
id: '1000855284966760491',
extra: null,
target: TextChannel {
type: 0,
guild: [Guild],
guildId: '992651008805195907',
parentId: '992651008805195908',
permissionOverwrites: [PermissionOverwriteManager],
messages: [MessageManager],
threads: [ThreadManager],
nsfw: false,
id: '1000855284966760490',
name: 'a',
rawPosition: 43,
topic: null,
lastMessageId: null,
rateLimitPerUser: 0
}
}
}
Collection(2) [Map] {
'993275405274468524' => {
targetType: 'Channel',
actionType: 'Create',
action: 10,
reason: null,
executor: '743378368031883337',
changes: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
id: '993275405274468524',
extra: null,
target: '993275405274468523',
createdTimestamp: 1656885710782
},
'1000855284966760491' => GuildAuditLogsEntry {
targetType: 'Channel',
actionType: 'Create',
action: 10,
reason: null,
executor: User {
id: '411886883983982593',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'ImMrBloo',
discriminator: '2292',
avatar: '4d8c64a8f4fae3b987701e8315013941',
banner: undefined,
accentColor: undefined
},
changes: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
id: '1000855284966760491',
extra: null,
target: TextChannel {
type: 0,
guild: [Guild],
guildId: '992651008805195907',
parentId: '992651008805195908',
permissionOverwrites: [PermissionOverwriteManager],
messages: [MessageManager],
threads: [ThreadManager],
nsfw: false,
id: '1000855284966760490',
name: 'a',
rawPosition: 43,
topic: null,
lastMessageId: null,
rateLimitPerUser: 0
}
}
}
10 replies
DIAdiscord.js - Imagine an app
Created by ImMrBloo on 7/25/2022 in #djs-questions
Audit Log Trouble
const guild = await client.guilds.cache.get('992651008805195907');

const getAuditLog = await guild.fetchAuditLogs();

const entries = await getAuditLog.entries;

// save the entries
const settings = await client.settings.get(guild.id, 'auditLogs');

// if there's no settings return and set the current auditLogs array
if(!settings){return client.settings.set(guild.id, entries, 'auditLogs');}


// get the difference from what's new and what's in the database
const newEntries = entries.difference(settings);
const guild = await client.guilds.cache.get('992651008805195907');

const getAuditLog = await guild.fetchAuditLogs();

const entries = await getAuditLog.entries;

// save the entries
const settings = await client.settings.get(guild.id, 'auditLogs');

// if there's no settings return and set the current auditLogs array
if(!settings){return client.settings.set(guild.id, entries, 'auditLogs');}


// get the difference from what's new and what's in the database
const newEntries = entries.difference(settings);
my code ^^
10 replies