defnot
defnot
DIAdiscord.js - Imagine an app
Created by defnot on 4/5/2024 in #djs-questions
Message missing Embeds that should be there. Restarting the bot fixes the problem.
"devDependencies": {
"@biomejs/biome": "1.6.1",
"@types/pg": "^8.11.2",
"bun-types": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"@napi-rs/canvas": "^0.1.44",
"discord.js": "^14.14.1",
"pg": "^8.11.3",
"ptero-client": "^1.1.3",
"sharp": "^0.33.1"
},
"devDependencies": {
"@biomejs/biome": "1.6.1",
"@types/pg": "^8.11.2",
"bun-types": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"@napi-rs/canvas": "^0.1.44",
"discord.js": "^14.14.1",
"pg": "^8.11.3",
"ptero-client": "^1.1.3",
"sharp": "^0.33.1"
},
3 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
thanks frogheart
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
it then goes and requests the score via RCON from the server
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
the user experience for people using that command is insane tho. you can get the score of any player (whitelisted: autocomplete) and the scoreboards also autocomplete
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
but like it has to actually get the whitelist from a minecraft server because i use the whitelisted people for the autocomplete
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
i hate this code
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
nah this is insanely unreadable
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
xDDDD
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
yea this works
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
i am sorry about this mess but this actually works
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
if (interaction.commandName === 'scoreboard') {
const objectives = Object.keys(dictionary119).map((key) => key);
const action = interaction.options.getString('action');

if (focused.name === 'playername') {
const { host, rconPort, rconPasswd } = config.mcConfig['smp'];

const whitelistNames = await getWhitelist(host, rconPort, rconPasswd);

return interaction.respond(mapChoices(whitelistNames));
} else if (focused.name === 'item') {
if (action === 'custom') {
return interaction.respond(mapChoices(customScoreboardObjectives));
} else {
if (!action) return interaction.respond([]);

const targetObjectives = objectives
.filter((obj) => obj.startsWith(action))
.map((item) => item.replace(action, ''));

return interaction.respond(mapChoices(targetObjectives));
}
}
}
if (interaction.commandName === 'scoreboard') {
const objectives = Object.keys(dictionary119).map((key) => key);
const action = interaction.options.getString('action');

if (focused.name === 'playername') {
const { host, rconPort, rconPasswd } = config.mcConfig['smp'];

const whitelistNames = await getWhitelist(host, rconPort, rconPasswd);

return interaction.respond(mapChoices(whitelistNames));
} else if (focused.name === 'item') {
if (action === 'custom') {
return interaction.respond(mapChoices(customScoreboardObjectives));
} else {
if (!action) return interaction.respond([]);

const targetObjectives = objectives
.filter((obj) => obj.startsWith(action))
.map((item) => item.replace(action, ''));

return interaction.respond(mapChoices(targetObjectives));
}
}
}
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
logging focused yields: { value: '', type: 3, name: 'playername', focused: true } when hovering over playername and { value: '', type: 3, name: 'item', focused: true } when hovering over item
29 replies
DIAdiscord.js - Imagine an app
Created by defnot on 3/5/2023 in #djs-questions
Handle multiple Autocomplete Events on the same Interaction
if (interaction.commandName === 'scoreboard') {
// const subcommand = interaction.options.getSubcommand() as
// | 'leaderboard'
// | 'players';

console.log(focused);

const objectives = Object.keys(dictionary119).map((key) => key);
const action = interaction.options.getString('action');

if (!action) return interaction.respond([]);

if (action === 'custom') {
return interaction.respond(mapChoices(customScoreboardObjectives));
} else {
const targetObjectives = objectives
.filter((obj) => obj.startsWith(action))
.map((item) => item.replace(action, ''));

return interaction.respond(mapChoices(targetObjectives));
}
}
if (interaction.commandName === 'scoreboard') {
// const subcommand = interaction.options.getSubcommand() as
// | 'leaderboard'
// | 'players';

console.log(focused);

const objectives = Object.keys(dictionary119).map((key) => key);
const action = interaction.options.getString('action');

if (!action) return interaction.respond([]);

if (action === 'custom') {
return interaction.respond(mapChoices(customScoreboardObjectives));
} else {
const targetObjectives = objectives
.filter((obj) => obj.startsWith(action))
.map((item) => item.replace(action, ''));

return interaction.respond(mapChoices(targetObjectives));
}
}
^ taken from autocomplete.ts
29 replies