sbot50
sbot50
Explore posts from servers
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
thx for the help btw
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
Ok, im less of an idiot than i thought, still dumb tho. Appearently my commands list was name-shadowed because the createglobalapplicationcommandsbuilder or whatever long name its called internally also has a commands list, so it was using that instead of mine.
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
give me 1 sec, if thats actually the issue ill close the post, but im pretty dissapointed in myself not spotting that
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
No description
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
it just makes an object of every command for future use
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
private val commands = listOf<Command>(
// General
Ping(),
WelcomeMsg(),

// Information
Define(),
Urbandefine(),

// Utility
Eval(),
Wolframalpha(),

// Moderation
Purge(),

// Fun
Coinflip(),
Diceroll(),
Magic8Ball(),
Walrus()
)
private val commands = listOf<Command>(
// General
Ping(),
WelcomeMsg(),

// Information
Define(),
Urbandefine(),

// Utility
Eval(),
Wolframalpha(),

// Moderation
Purge(),

// Fun
Coinflip(),
Diceroll(),
Magic8Ball(),
Walrus()
)
this is commands
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
because i thought maybe the issue was that it registered the same cmd every loop
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
I should mention that this:
val cmds = getKord().createGlobalApplicationCommands {
Ping().register(this)
}
val cmds = getKord().createGlobalApplicationCommands {
Ping().register(this)
}
works fine (aka getting a command and doing .register without going through a loop, I dislike this solution tho because then i already have all commands in a list so i can reference them later. So based on this my assumption is that its a scoping issue
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
If i do this however:
val cmds = getKord().createGlobalApplicationCommands {
input("a", "b") {}
for (command in commands) {
break
}
}
val cmds = getKord().createGlobalApplicationCommands {
input("a", "b") {}
for (command in commands) {
break
}
}
it obviously works fine, I also tried setting this to a variable if that somehow would matter, but no luck
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
In the init functions of my Commands class I have this code:
val cmds = getKord().createGlobalApplicationCommands {
for (command in commands) {
(command as Command).register(this)
}
}
val cmds = getKord().createGlobalApplicationCommands {
for (command in commands) {
(command as Command).register(this)
}
}
To be clear however, this doesnt work either
val cmds = getKord().createGlobalApplicationCommands {
for (command in commands) {
input("a", "b") {}
break
}
}
val cmds = getKord().createGlobalApplicationCommands {
for (command in commands) {
input("a", "b") {}
break
}
}
the register function in commands literally just does this, unless overridden:
open fun register(builder: MultiApplicationCommandBuilder) {
return builder.input(cmdName, cmdDescription)
}
open fun register(builder: MultiApplicationCommandBuilder) {
return builder.input(cmdName, cmdDescription)
}
15 replies
KKord
Created by sbot50 on 12/13/2024 in #help
Is there a good way to register all commands at once?
sure
15 replies
KKord
Created by sbot50 on 11/20/2024 in #help
How do I get the category a channel is in?
Ok so no clue what i would want to but in the <> of .getChannelOf, but theoretically i could cast it as a categorizablechannel and then get the category then do .asChannel and i will have the category. (if i wasnt hit with more access bs from dc, but ill figure it out from here) thanks.
3 replies
KKord
Created by sbot50 on 11/7/2024 in #help
How do you create an embed?
thank you
4 replies
KKord
Created by sbot50 on 11/7/2024 in #help
How do you create an embed?
ohhhhh
4 replies
DIdiscord.js - Imagine ❄
Created by sbot50 on 6/21/2024 in #djs-questions
Message interaction is null
I found out that im an idiot, i recoded it wrong and it summons a new msg. I'll mark this as closed
5 replies
DIdiscord.js - Imagine ❄
Created by sbot50 on 6/21/2024 in #djs-questions
Message interaction is null
I dont see how most of this is relevant but ok Node version: v22.3.0 DiscordJS version: 14.15.3 Might be a dc api issue, seeing as theyre moving to inteaction_metadata or smth Code:
const guild = await this.client.guilds.cache.get(interaction.guildId);
const channel = await guild.channels.cache.get(interaction.channelId);
const msg = await channel.messages.fetch(interaction.message.id);
console.log(interaction.message);
console.log(msg);
const guild = await this.client.guilds.cache.get(interaction.guildId);
const channel = await guild.channels.cache.get(interaction.channelId);
const msg = await channel.messages.fetch(interaction.message.id);
console.log(interaction.message);
console.log(msg);
The stack trace really isnt needed, it just that in the logs the value of interaction for the msg object is null unless its the first button press.
5 replies