Skip to content

Commit 56cdac7

Browse files
TheArmaganErdemGKSL
andcommitted
Bastım sana!
Co-Authored-By: Erdem <[email protected]>
1 parent d21ed6d commit 56cdac7

File tree

9 files changed

+31
-8
lines changed

9 files changed

+31
-8
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ console.info("[BİLGİ] Basit Altyapı v1.8.6 - by Kıraç Armağan Önal");
151151

152152
let uInter = Underline.interactions.find(uInter => {
153153
switch (uInter.name.length) {
154-
case 1: return (uInter.name[0] == interaction.commandName) || ((uInter.name[0] == interaction.customId) && (
154+
case 1: return (uInter.name[0] == interaction.commandName) || ((uInter.id == interaction.customId) && (
155155
(uInter.actionType == "CHAT_INPUT" && (interaction.isCommand() || interaction.isAutocomplete())) ||
156156
(uInter.actionType == "SELECT_MENU" && interaction.isSelectMenu()) ||
157157
(uInter.actionType == "BUTTON" && interaction.isButton()) ||

interactions/butonYolla.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = new Underline.SlashCommand({
88
{
99
type: "ACTION_ROW",
1010
components: [
11-
Underline.interactions.get("basBana").toJSON()
11+
Underline.interactions.get("secBeni").toJSON()
1212
]
1313
}
1414
]
File renamed without changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = new Underline.SelectMenu({
2+
id: "secBeni",
3+
name: "secBeni",
4+
description: "...",
5+
onInteraction(inter, other) {
6+
inter.reply({
7+
content: inter.values[0] || "yok bişi seç.",
8+
ephemeral: true
9+
})
10+
},
11+
options: {
12+
get choices() {
13+
return Array(25).fill("").map((_, i) => ({ label: Math.random().toString(), value: `${i}`}))
14+
}
15+
},
16+
guildOnly: false,
17+
developerOnly: false
18+
});

other/generator.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,13 @@ makeSureFolderExistsSync("./events");
214214
}
215215
let resultText = `
216216
module.exports = new Underline.${transformer[interActionType] ?? ""}({
217+
${interActionType == "BUTTON" || interActionType == "SELECT_MENU" ? `id: ${JSON.stringify(interName)},` : ""}
217218
name: ${JSON.stringify(interName)},
218219
${interDesc ? `description: ${JSON.stringify(interDesc)},` : ""}
219220
onInteraction(inter, other) {
220221
// Kodunuz bruh, kolay gelsin!
221222
},
222-
${interActionType == "BUTTON" || interActionType == "MESSAGE" || interActionType == "USER" ? "" : "options: [],"}
223+
${interActionType == "MESSAGE" || interActionType == "USER" ? "" : `options: ${interActionType == "BUTTON" || interActionType == "SELECT_MENU" ? "{}" : "[]"},`}
223224
${interCoolDown ? `coolDown: ${interCoolDown},` : ""}
224225
guildOnly: ${interGuildOnly},
225226
developerOnly: ${interDeveloperOnly}${interBotPerms.length > 0 || interUserPerms.length > 0 ? `,` : ""}

types/Button.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ class Button extends Interaction {
1212
}
1313
isButton() { return true; }
1414
toJSON() {
15-
let button = new MessageButton().setCustomId(this.name[0]).setStyle(this.options.style)
15+
let button = new MessageButton()
16+
.setCustomId(this.id)
17+
.setStyle(this.options.style);
1618
if (this.options.emoji) button.setEmoji(this.options.emoji);
1719
if (this.options.label) button.setLabel(this.options.label);
1820
if (this.options.url) button.setURL(this.options.url);

types/Interaction.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ interface CustomSelectMenuOptions {
2525
max?: number;
2626
choices: MessageSelectOptionData[];
2727
placeholder?: string;
28-
onComplete?(interaction: SelectMenuInteraction): MessageSelectOptionData[]
2928
}
3029

3130
interface CustomButtonOptions {

types/Interaction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Interaction {
4141
this.name = Array.isArray(arg.name) ? arg.name : [arg.name];
4242
this.actionType = arg.actionType || Underline.config.interactionDefaults.actionType;
4343

44-
this.id = arg.id || `${this.actionType}:${this.name.join(" ")}`;
44+
this.id = arg.id || `${this.actionType}_${this.name.join("_")}`.toLowerCase();
4545
this._type = arg._type ?? this._type;
4646
this.perms.bot = Array.isArray(arg.perms?.bot) && arg.perms.bot.length != 0 ? arg.perms.bot : Underline.config.interactionDefaults.perms.bot;
4747
this.perms.user = Array.isArray(arg.perms?.user) && arg.perms.user.length != 0 ? arg.perms.user : Underline.config.interactionDefaults.perms.user;

types/SelectMenu.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ class SelectMenu extends Interaction {
1616
isUserActionCommand() { return false; }
1717
isMessageActionCommand() { return false; }
1818
toJSON() {
19-
let menu = new MessageSelectMenu().addOptions( this.options?.onComplete ? this.options.onComplete() : (this.options?.choices ?? []) )
20-
.setMinValues(this.options.min ?? 1).setMaxValues(this.options.max ?? this.options.choices.length).setCustomId(this.name)
19+
let menu = new MessageSelectMenu()
20+
.addOptions(this.options?.choices ?? [])
21+
.setMinValues(this.options.min ?? 1)
22+
.setMaxValues(this.options.max ?? this.options.choices.length)
23+
.setCustomId(this.id);
2124
if(this.options.placeholder) menu.setPlaceholder(this.options.placeholder)
2225
return menu;
2326
}

0 commit comments

Comments
 (0)