Skip to content

Commit 003c079

Browse files
authored
Merge pull request #18 from TheArmagan/main-pull-erdem
Added Publish Types
2 parents 1685a0d + 9325ee5 commit 003c079

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

interactions/reload.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ module.exports = new Underline.SlashCommand({
1313
coolDown: {
1414
type: "any",
1515
amount: 180000
16-
}
16+
},
17+
publishType: "guildOnly"
1718
})

other/generator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ module.exports = new Underline.${transformer[interActionType] ?? ""}({
233233
},
234234
${interActionType == "MESSAGE" || interActionType == "USER" ? "" : `options: ${interActionType == "BUTTON" || interActionType == "SELECT_MENU" ? "{}" : "[]"},`}
235235
${interCoolDown ? `coolDown: ${interCoolDown},` : ""}
236+
${interActionType == "MESSAGE" || interActionType == "USER" ? "publishType: \"all\"," : ""}
236237
guildOnly: ${interGuildOnly}${interBotPerms.length > 0 || interUserPerms.length > 0 ? `,` : ""}
237238
${interBotPerms.length > 0 || interUserPerms.length > 0 ? `perms: {` : ""}
238239
${interBotPerms.length > 0 ? ` bot: ${JSON.stringify(interBotPerms)},` : ""}

publishInteractions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ globalThis.Underline = {
5858
/** @type {import("./types/Interaction")} */
5959
let uInter = require(interactionFilePath);
6060
if(uInter?._type != "interaction") return;
61+
if (!uInter.publishType) uInter.publishType = "all";
62+
if (!(uInter.publishType == "all" || (uInter.publishType == "guildOnly" && publishMode == "global") || (uInter.publishType == "globalOnly" && publishMode == "global"))) {
63+
console.warn(`Interaksiyon "${uInter.actionType == "CHAT_INPUT" ? `/${uInter.name.join(" ")}` : `${uInter.name[0]}`}" dönüştürülme listesine eklenmedi çünkü interaksiyon paylaşılma tipi(${uInter.publishType}) ile paylaşma modu(${publishMode}) uyumsuz!`);
64+
return;
65+
}
6166
console.info(`Interaksiyon "${uInter.actionType == "CHAT_INPUT" ? `/${uInter.name.join(" ")}` : `${uInter.name[0]}`}" dönüştürülme listesine eklendi!`);
6267
uInters.push(uInter);
6368
});

types/Interaction.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class BaseInteraction {
5454
perms?: { bot: PermissionString[], user: UserPermString[] };
5555
onInteraction(interaction: CommandInteraction | ContextMenuInteraction, other: IOther): void;
5656
toJSON(): MessageButton | MessageSelectMenu | undefined;
57+
publishType?: "globalOnly" | "guildOnly" | "all";
5758
onLoad?(client: Client): void;
5859
coolDowns: Map<string, number>;
5960
description!: string;

0 commit comments

Comments
 (0)