commandkit 0.1.11-dev.20250330073734 → 0.1.11-dev.20250330115232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +260 -2
- package/dist/index.js +996 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -707,6 +707,908 @@ var init_Modal = __esm({
|
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
709
|
|
|
710
|
+
// src/components/select-menu/StringSelectMenuKit.ts
|
|
711
|
+
var import_discord6, _onSelectHandler, _contextData3, _unsub3, _StringSelectMenuKit_instances, getEventInterceptor_fn3, setupCollector_fn2, destroyCollector_fn3, _StringSelectMenuKit, StringSelectMenuKit;
|
|
712
|
+
var init_StringSelectMenuKit = __esm({
|
|
713
|
+
"src/components/select-menu/StringSelectMenuKit.ts"() {
|
|
714
|
+
"use strict";
|
|
715
|
+
init_cjs_shims();
|
|
716
|
+
import_discord6 = require("discord.js");
|
|
717
|
+
init_async_context();
|
|
718
|
+
_StringSelectMenuKit = class _StringSelectMenuKit extends import_discord6.StringSelectMenuBuilder {
|
|
719
|
+
constructor() {
|
|
720
|
+
super(...arguments);
|
|
721
|
+
__privateAdd(this, _StringSelectMenuKit_instances);
|
|
722
|
+
__privateAdd(this, _onSelectHandler, null);
|
|
723
|
+
__privateAdd(this, _contextData3, {
|
|
724
|
+
autoReset: false,
|
|
725
|
+
time: 5 * 60 * 1e3,
|
|
726
|
+
once: true
|
|
727
|
+
});
|
|
728
|
+
__privateAdd(this, _unsub3, null);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Sets the handler to run when the modal is submitted.
|
|
732
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
733
|
+
* @param data - The context data for the interaction collector.
|
|
734
|
+
* @returns This instance of the modal builder.
|
|
735
|
+
* @example
|
|
736
|
+
* ```ts
|
|
737
|
+
* const modal = new StringSelectMenuKit()
|
|
738
|
+
* .setTitle('My Modal')
|
|
739
|
+
* .setCustomId('my-modal')
|
|
740
|
+
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
741
|
+
* .onSelect(async (interaction) => {
|
|
742
|
+
* await interaction.reply('You submitted the modal!');
|
|
743
|
+
* })
|
|
744
|
+
* .addComponents(actionRow1, actionRow2);
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
onSelect(handler, data) {
|
|
748
|
+
var _a, _b, _c, _d;
|
|
749
|
+
if (!handler) {
|
|
750
|
+
throw new TypeError(
|
|
751
|
+
'Cannot setup "onClick" without a handler function parameter.'
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
if (__privateGet(this, _onSelectHandler)) {
|
|
755
|
+
__privateMethod(this, _StringSelectMenuKit_instances, destroyCollector_fn3).call(this);
|
|
756
|
+
}
|
|
757
|
+
__privateSet(this, _onSelectHandler, handler);
|
|
758
|
+
if (data) {
|
|
759
|
+
__privateSet(this, _contextData3, {
|
|
760
|
+
autoReset: data.autoReset ?? ((_a = __privateGet(this, _contextData3)) == null ? void 0 : _a.autoReset) ?? true,
|
|
761
|
+
time: data.time ?? ((_b = __privateGet(this, _contextData3)) == null ? void 0 : _b.time) ?? 5 * 60 * 1e3,
|
|
762
|
+
filter: data.filter ?? ((_c = __privateGet(this, _contextData3)) == null ? void 0 : _c.filter),
|
|
763
|
+
onEnd: data.onEnd ?? ((_d = __privateGet(this, _contextData3)) == null ? void 0 : _d.onEnd)
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
__privateMethod(this, _StringSelectMenuKit_instances, setupCollector_fn2).call(this);
|
|
767
|
+
return this;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Sets the handler to run when the interaction collector ends.
|
|
771
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
772
|
+
* @returns This instance of the modal builder.
|
|
773
|
+
*/
|
|
774
|
+
onEnd(handler) {
|
|
775
|
+
if (!handler) {
|
|
776
|
+
throw new TypeError(
|
|
777
|
+
'Cannot setup "onEnd" without a handler function parameter.'
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
__privateGet(this, _contextData3) ?? __privateSet(this, _contextData3, {});
|
|
781
|
+
__privateGet(this, _contextData3).onEnd = handler;
|
|
782
|
+
return this;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Sets the handler to run when the interaction collector ends.
|
|
786
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
787
|
+
* @returns This instance of the modal builder.
|
|
788
|
+
*/
|
|
789
|
+
onError(handler) {
|
|
790
|
+
if (!handler) {
|
|
791
|
+
throw new TypeError(
|
|
792
|
+
'Cannot setup "onError" without a handler function parameter.'
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
__privateGet(this, _contextData3) ?? __privateSet(this, _contextData3, {});
|
|
796
|
+
__privateGet(this, _contextData3).onError = handler;
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Sets a filter for the interaction collector.
|
|
801
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
802
|
+
* @returns This instance of the modal builder.
|
|
803
|
+
*/
|
|
804
|
+
filter(predicate) {
|
|
805
|
+
__privateGet(this, _contextData3) ?? __privateSet(this, _contextData3, {
|
|
806
|
+
autoReset: true,
|
|
807
|
+
time: 5 * 60 * 1e3
|
|
808
|
+
});
|
|
809
|
+
__privateGet(this, _contextData3).filter = predicate;
|
|
810
|
+
return this;
|
|
811
|
+
}
|
|
812
|
+
get customId() {
|
|
813
|
+
return this.data.custom_id ?? this.data.customId;
|
|
814
|
+
}
|
|
815
|
+
dispose() {
|
|
816
|
+
__privateMethod(this, _StringSelectMenuKit_instances, destroyCollector_fn3).call(this);
|
|
817
|
+
return this;
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
_onSelectHandler = new WeakMap();
|
|
821
|
+
_contextData3 = new WeakMap();
|
|
822
|
+
_unsub3 = new WeakMap();
|
|
823
|
+
_StringSelectMenuKit_instances = new WeakSet();
|
|
824
|
+
getEventInterceptor_fn3 = /* @__PURE__ */ __name(function() {
|
|
825
|
+
const ctx = getContext();
|
|
826
|
+
if (!ctx) return getCommandKit(true).eventInterceptor;
|
|
827
|
+
return exitContext(() => ctx.commandkit.eventInterceptor);
|
|
828
|
+
}, "#getEventInterceptor");
|
|
829
|
+
setupCollector_fn2 = /* @__PURE__ */ __name(function() {
|
|
830
|
+
if (!__privateGet(this, _contextData3)) return;
|
|
831
|
+
if (!this.customId) {
|
|
832
|
+
throw new TypeError(
|
|
833
|
+
"Cannot setup an modal collector without a custom ID."
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
const interceptor = __privateMethod(this, _StringSelectMenuKit_instances, getEventInterceptor_fn3).call(this);
|
|
837
|
+
if (!interceptor) return;
|
|
838
|
+
__privateSet(this, _unsub3, interceptor.subscribe(
|
|
839
|
+
import_discord6.Events.InteractionCreate,
|
|
840
|
+
async (interaction) => {
|
|
841
|
+
var _a, _b;
|
|
842
|
+
if (!interaction.isStringSelectMenu()) return;
|
|
843
|
+
const myCustomId = this.customId ?? null;
|
|
844
|
+
const interactionCustomId = interaction.customId;
|
|
845
|
+
if (myCustomId && interactionCustomId !== myCustomId) return;
|
|
846
|
+
const filter = (_a = __privateGet(this, _contextData3)) == null ? void 0 : _a.filter;
|
|
847
|
+
if (filter && !await filter(interaction)) return;
|
|
848
|
+
const handler = __privateGet(this, _onSelectHandler);
|
|
849
|
+
if (!handler) return (_b = __privateGet(this, _unsub3)) == null ? void 0 : _b.call(this);
|
|
850
|
+
return handler(interaction, this);
|
|
851
|
+
},
|
|
852
|
+
__privateGet(this, _contextData3)
|
|
853
|
+
));
|
|
854
|
+
}, "#setupCollector");
|
|
855
|
+
destroyCollector_fn3 = /* @__PURE__ */ __name(function() {
|
|
856
|
+
var _a;
|
|
857
|
+
(_a = __privateGet(this, _unsub3)) == null ? void 0 : _a.call(this);
|
|
858
|
+
__privateSet(this, _unsub3, null);
|
|
859
|
+
__privateSet(this, _onSelectHandler, null);
|
|
860
|
+
__privateSet(this, _contextData3, null);
|
|
861
|
+
}, "#destroyCollector");
|
|
862
|
+
__name(_StringSelectMenuKit, "StringSelectMenuKit");
|
|
863
|
+
StringSelectMenuKit = _StringSelectMenuKit;
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
// src/components/select-menu/ChannelSelectMenuKit.ts
|
|
868
|
+
var import_discord7, _onSelectHandler2, _contextData4, _unsub4, _ChannelSelectMenuKit_instances, getEventInterceptor_fn4, setupCollector_fn3, destroyCollector_fn4, _ChannelSelectMenuKit, ChannelSelectMenuKit;
|
|
869
|
+
var init_ChannelSelectMenuKit = __esm({
|
|
870
|
+
"src/components/select-menu/ChannelSelectMenuKit.ts"() {
|
|
871
|
+
"use strict";
|
|
872
|
+
init_cjs_shims();
|
|
873
|
+
import_discord7 = require("discord.js");
|
|
874
|
+
init_async_context();
|
|
875
|
+
_ChannelSelectMenuKit = class _ChannelSelectMenuKit extends import_discord7.ChannelSelectMenuBuilder {
|
|
876
|
+
constructor() {
|
|
877
|
+
super(...arguments);
|
|
878
|
+
__privateAdd(this, _ChannelSelectMenuKit_instances);
|
|
879
|
+
__privateAdd(this, _onSelectHandler2, null);
|
|
880
|
+
__privateAdd(this, _contextData4, {
|
|
881
|
+
autoReset: false,
|
|
882
|
+
time: 5 * 60 * 1e3,
|
|
883
|
+
once: true
|
|
884
|
+
});
|
|
885
|
+
__privateAdd(this, _unsub4, null);
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Sets the handler to run when the modal is submitted.
|
|
889
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
890
|
+
* @param data - The context data for the interaction collector.
|
|
891
|
+
* @returns This instance of the modal builder.
|
|
892
|
+
* @example
|
|
893
|
+
* ```ts
|
|
894
|
+
* const modal = new ChannelSelectMenuKit()
|
|
895
|
+
* .setTitle('My Modal')
|
|
896
|
+
* .setCustomId('my-modal')
|
|
897
|
+
* .filter((interaction) => interaction.Channel.id === '1234567890')
|
|
898
|
+
* .onSelect(async (interaction) => {
|
|
899
|
+
* await interaction.reply('You submitted the modal!');
|
|
900
|
+
* })
|
|
901
|
+
* .addComponents(actionRow1, actionRow2);
|
|
902
|
+
* ```
|
|
903
|
+
*/
|
|
904
|
+
onSelect(handler, data) {
|
|
905
|
+
var _a, _b, _c, _d;
|
|
906
|
+
if (!handler) {
|
|
907
|
+
throw new TypeError(
|
|
908
|
+
'Cannot setup "onClick" without a handler function parameter.'
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
if (__privateGet(this, _onSelectHandler2)) {
|
|
912
|
+
__privateMethod(this, _ChannelSelectMenuKit_instances, destroyCollector_fn4).call(this);
|
|
913
|
+
}
|
|
914
|
+
__privateSet(this, _onSelectHandler2, handler);
|
|
915
|
+
if (data) {
|
|
916
|
+
__privateSet(this, _contextData4, {
|
|
917
|
+
autoReset: data.autoReset ?? ((_a = __privateGet(this, _contextData4)) == null ? void 0 : _a.autoReset) ?? true,
|
|
918
|
+
time: data.time ?? ((_b = __privateGet(this, _contextData4)) == null ? void 0 : _b.time) ?? 5 * 60 * 1e3,
|
|
919
|
+
filter: data.filter ?? ((_c = __privateGet(this, _contextData4)) == null ? void 0 : _c.filter),
|
|
920
|
+
onEnd: data.onEnd ?? ((_d = __privateGet(this, _contextData4)) == null ? void 0 : _d.onEnd)
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
__privateMethod(this, _ChannelSelectMenuKit_instances, setupCollector_fn3).call(this);
|
|
924
|
+
return this;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Sets the handler to run when the interaction collector ends.
|
|
928
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
929
|
+
* @returns This instance of the modal builder.
|
|
930
|
+
*/
|
|
931
|
+
onEnd(handler) {
|
|
932
|
+
if (!handler) {
|
|
933
|
+
throw new TypeError(
|
|
934
|
+
'Cannot setup "onEnd" without a handler function parameter.'
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
__privateGet(this, _contextData4) ?? __privateSet(this, _contextData4, {});
|
|
938
|
+
__privateGet(this, _contextData4).onEnd = handler;
|
|
939
|
+
return this;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Sets the handler to run when the interaction collector ends.
|
|
943
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
944
|
+
* @returns This instance of the modal builder.
|
|
945
|
+
*/
|
|
946
|
+
onError(handler) {
|
|
947
|
+
if (!handler) {
|
|
948
|
+
throw new TypeError(
|
|
949
|
+
'Cannot setup "onError" without a handler function parameter.'
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
__privateGet(this, _contextData4) ?? __privateSet(this, _contextData4, {});
|
|
953
|
+
__privateGet(this, _contextData4).onError = handler;
|
|
954
|
+
return this;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Sets a filter for the interaction collector.
|
|
958
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
959
|
+
* @returns This instance of the modal builder.
|
|
960
|
+
*/
|
|
961
|
+
filter(predicate) {
|
|
962
|
+
__privateGet(this, _contextData4) ?? __privateSet(this, _contextData4, {
|
|
963
|
+
autoReset: true,
|
|
964
|
+
time: 5 * 60 * 1e3
|
|
965
|
+
});
|
|
966
|
+
__privateGet(this, _contextData4).filter = predicate;
|
|
967
|
+
return this;
|
|
968
|
+
}
|
|
969
|
+
get customId() {
|
|
970
|
+
return this.data.custom_id ?? this.data.customId;
|
|
971
|
+
}
|
|
972
|
+
dispose() {
|
|
973
|
+
__privateMethod(this, _ChannelSelectMenuKit_instances, destroyCollector_fn4).call(this);
|
|
974
|
+
return this;
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
_onSelectHandler2 = new WeakMap();
|
|
978
|
+
_contextData4 = new WeakMap();
|
|
979
|
+
_unsub4 = new WeakMap();
|
|
980
|
+
_ChannelSelectMenuKit_instances = new WeakSet();
|
|
981
|
+
getEventInterceptor_fn4 = /* @__PURE__ */ __name(function() {
|
|
982
|
+
const ctx = getContext();
|
|
983
|
+
if (!ctx) return getCommandKit(true).eventInterceptor;
|
|
984
|
+
return exitContext(() => ctx.commandkit.eventInterceptor);
|
|
985
|
+
}, "#getEventInterceptor");
|
|
986
|
+
setupCollector_fn3 = /* @__PURE__ */ __name(function() {
|
|
987
|
+
if (!__privateGet(this, _contextData4)) return;
|
|
988
|
+
if (!this.customId) {
|
|
989
|
+
throw new TypeError(
|
|
990
|
+
"Cannot setup an modal collector without a custom ID."
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
const interceptor = __privateMethod(this, _ChannelSelectMenuKit_instances, getEventInterceptor_fn4).call(this);
|
|
994
|
+
if (!interceptor) return;
|
|
995
|
+
__privateSet(this, _unsub4, interceptor.subscribe(
|
|
996
|
+
import_discord7.Events.InteractionCreate,
|
|
997
|
+
async (interaction) => {
|
|
998
|
+
var _a, _b;
|
|
999
|
+
if (!interaction.isChannelSelectMenu()) return;
|
|
1000
|
+
const myCustomId = this.customId ?? null;
|
|
1001
|
+
const interactionCustomId = interaction.customId;
|
|
1002
|
+
if (myCustomId && interactionCustomId !== myCustomId) return;
|
|
1003
|
+
const filter = (_a = __privateGet(this, _contextData4)) == null ? void 0 : _a.filter;
|
|
1004
|
+
if (filter && !await filter(interaction)) return;
|
|
1005
|
+
const handler = __privateGet(this, _onSelectHandler2);
|
|
1006
|
+
if (!handler) return (_b = __privateGet(this, _unsub4)) == null ? void 0 : _b.call(this);
|
|
1007
|
+
return handler(interaction, this);
|
|
1008
|
+
},
|
|
1009
|
+
__privateGet(this, _contextData4)
|
|
1010
|
+
));
|
|
1011
|
+
}, "#setupCollector");
|
|
1012
|
+
destroyCollector_fn4 = /* @__PURE__ */ __name(function() {
|
|
1013
|
+
var _a;
|
|
1014
|
+
(_a = __privateGet(this, _unsub4)) == null ? void 0 : _a.call(this);
|
|
1015
|
+
__privateSet(this, _unsub4, null);
|
|
1016
|
+
__privateSet(this, _onSelectHandler2, null);
|
|
1017
|
+
__privateSet(this, _contextData4, null);
|
|
1018
|
+
}, "#destroyCollector");
|
|
1019
|
+
__name(_ChannelSelectMenuKit, "ChannelSelectMenuKit");
|
|
1020
|
+
ChannelSelectMenuKit = _ChannelSelectMenuKit;
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
// src/components/select-menu/MentionableSelectMenuKit.ts
|
|
1025
|
+
var import_discord8, _onSelectHandler3, _contextData5, _unsub5, _MentionableSelectMenuKit_instances, getEventInterceptor_fn5, setupCollector_fn4, destroyCollector_fn5, _MentionableSelectMenuKit, MentionableSelectMenuKit;
|
|
1026
|
+
var init_MentionableSelectMenuKit = __esm({
|
|
1027
|
+
"src/components/select-menu/MentionableSelectMenuKit.ts"() {
|
|
1028
|
+
"use strict";
|
|
1029
|
+
init_cjs_shims();
|
|
1030
|
+
import_discord8 = require("discord.js");
|
|
1031
|
+
init_async_context();
|
|
1032
|
+
_MentionableSelectMenuKit = class _MentionableSelectMenuKit extends import_discord8.MentionableSelectMenuBuilder {
|
|
1033
|
+
constructor() {
|
|
1034
|
+
super(...arguments);
|
|
1035
|
+
__privateAdd(this, _MentionableSelectMenuKit_instances);
|
|
1036
|
+
__privateAdd(this, _onSelectHandler3, null);
|
|
1037
|
+
__privateAdd(this, _contextData5, {
|
|
1038
|
+
autoReset: false,
|
|
1039
|
+
time: 5 * 60 * 1e3,
|
|
1040
|
+
once: true
|
|
1041
|
+
});
|
|
1042
|
+
__privateAdd(this, _unsub5, null);
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Sets the handler to run when the modal is submitted.
|
|
1046
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
1047
|
+
* @param data - The context data for the interaction collector.
|
|
1048
|
+
* @returns This instance of the modal builder.
|
|
1049
|
+
* @example
|
|
1050
|
+
* ```ts
|
|
1051
|
+
* const modal = new MentionableSelectMenuKit()
|
|
1052
|
+
* .setTitle('My Modal')
|
|
1053
|
+
* .setCustomId('my-modal')
|
|
1054
|
+
* .filter((interaction) => interaction.Mentionable.id === '1234567890')
|
|
1055
|
+
* .onSelect(async (interaction) => {
|
|
1056
|
+
* await interaction.reply('You submitted the modal!');
|
|
1057
|
+
* })
|
|
1058
|
+
* .addComponents(actionRow1, actionRow2);
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
onSelect(handler, data) {
|
|
1062
|
+
var _a, _b, _c, _d;
|
|
1063
|
+
if (!handler) {
|
|
1064
|
+
throw new TypeError(
|
|
1065
|
+
'Cannot setup "onClick" without a handler function parameter.'
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
if (__privateGet(this, _onSelectHandler3)) {
|
|
1069
|
+
__privateMethod(this, _MentionableSelectMenuKit_instances, destroyCollector_fn5).call(this);
|
|
1070
|
+
}
|
|
1071
|
+
__privateSet(this, _onSelectHandler3, handler);
|
|
1072
|
+
if (data) {
|
|
1073
|
+
__privateSet(this, _contextData5, {
|
|
1074
|
+
autoReset: data.autoReset ?? ((_a = __privateGet(this, _contextData5)) == null ? void 0 : _a.autoReset) ?? true,
|
|
1075
|
+
time: data.time ?? ((_b = __privateGet(this, _contextData5)) == null ? void 0 : _b.time) ?? 5 * 60 * 1e3,
|
|
1076
|
+
filter: data.filter ?? ((_c = __privateGet(this, _contextData5)) == null ? void 0 : _c.filter),
|
|
1077
|
+
onEnd: data.onEnd ?? ((_d = __privateGet(this, _contextData5)) == null ? void 0 : _d.onEnd)
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
__privateMethod(this, _MentionableSelectMenuKit_instances, setupCollector_fn4).call(this);
|
|
1081
|
+
return this;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Sets the handler to run when the interaction collector ends.
|
|
1085
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
1086
|
+
* @returns This instance of the modal builder.
|
|
1087
|
+
*/
|
|
1088
|
+
onEnd(handler) {
|
|
1089
|
+
if (!handler) {
|
|
1090
|
+
throw new TypeError(
|
|
1091
|
+
'Cannot setup "onEnd" without a handler function parameter.'
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
__privateGet(this, _contextData5) ?? __privateSet(this, _contextData5, {});
|
|
1095
|
+
__privateGet(this, _contextData5).onEnd = handler;
|
|
1096
|
+
return this;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Sets the handler to run when the interaction collector ends.
|
|
1100
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
1101
|
+
* @returns This instance of the modal builder.
|
|
1102
|
+
*/
|
|
1103
|
+
onError(handler) {
|
|
1104
|
+
if (!handler) {
|
|
1105
|
+
throw new TypeError(
|
|
1106
|
+
'Cannot setup "onError" without a handler function parameter.'
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
__privateGet(this, _contextData5) ?? __privateSet(this, _contextData5, {});
|
|
1110
|
+
__privateGet(this, _contextData5).onError = handler;
|
|
1111
|
+
return this;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Sets a filter for the interaction collector.
|
|
1115
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
1116
|
+
* @returns This instance of the modal builder.
|
|
1117
|
+
*/
|
|
1118
|
+
filter(predicate) {
|
|
1119
|
+
__privateGet(this, _contextData5) ?? __privateSet(this, _contextData5, {
|
|
1120
|
+
autoReset: true,
|
|
1121
|
+
time: 5 * 60 * 1e3
|
|
1122
|
+
});
|
|
1123
|
+
__privateGet(this, _contextData5).filter = predicate;
|
|
1124
|
+
return this;
|
|
1125
|
+
}
|
|
1126
|
+
get customId() {
|
|
1127
|
+
return this.data.custom_id ?? this.data.customId;
|
|
1128
|
+
}
|
|
1129
|
+
dispose() {
|
|
1130
|
+
__privateMethod(this, _MentionableSelectMenuKit_instances, destroyCollector_fn5).call(this);
|
|
1131
|
+
return this;
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
_onSelectHandler3 = new WeakMap();
|
|
1135
|
+
_contextData5 = new WeakMap();
|
|
1136
|
+
_unsub5 = new WeakMap();
|
|
1137
|
+
_MentionableSelectMenuKit_instances = new WeakSet();
|
|
1138
|
+
getEventInterceptor_fn5 = /* @__PURE__ */ __name(function() {
|
|
1139
|
+
const ctx = getContext();
|
|
1140
|
+
if (!ctx) return getCommandKit(true).eventInterceptor;
|
|
1141
|
+
return exitContext(() => ctx.commandkit.eventInterceptor);
|
|
1142
|
+
}, "#getEventInterceptor");
|
|
1143
|
+
setupCollector_fn4 = /* @__PURE__ */ __name(function() {
|
|
1144
|
+
if (!__privateGet(this, _contextData5)) return;
|
|
1145
|
+
if (!this.customId) {
|
|
1146
|
+
throw new TypeError(
|
|
1147
|
+
"Cannot setup an modal collector without a custom ID."
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
const interceptor = __privateMethod(this, _MentionableSelectMenuKit_instances, getEventInterceptor_fn5).call(this);
|
|
1151
|
+
if (!interceptor) return;
|
|
1152
|
+
__privateSet(this, _unsub5, interceptor.subscribe(
|
|
1153
|
+
import_discord8.Events.InteractionCreate,
|
|
1154
|
+
async (interaction) => {
|
|
1155
|
+
var _a, _b;
|
|
1156
|
+
if (!interaction.isMentionableSelectMenu()) return;
|
|
1157
|
+
const myCustomId = this.customId ?? null;
|
|
1158
|
+
const interactionCustomId = interaction.customId;
|
|
1159
|
+
if (myCustomId && interactionCustomId !== myCustomId) return;
|
|
1160
|
+
const filter = (_a = __privateGet(this, _contextData5)) == null ? void 0 : _a.filter;
|
|
1161
|
+
if (filter && !await filter(interaction)) return;
|
|
1162
|
+
const handler = __privateGet(this, _onSelectHandler3);
|
|
1163
|
+
if (!handler) return (_b = __privateGet(this, _unsub5)) == null ? void 0 : _b.call(this);
|
|
1164
|
+
return handler(interaction, this);
|
|
1165
|
+
},
|
|
1166
|
+
__privateGet(this, _contextData5)
|
|
1167
|
+
));
|
|
1168
|
+
}, "#setupCollector");
|
|
1169
|
+
destroyCollector_fn5 = /* @__PURE__ */ __name(function() {
|
|
1170
|
+
var _a;
|
|
1171
|
+
(_a = __privateGet(this, _unsub5)) == null ? void 0 : _a.call(this);
|
|
1172
|
+
__privateSet(this, _unsub5, null);
|
|
1173
|
+
__privateSet(this, _onSelectHandler3, null);
|
|
1174
|
+
__privateSet(this, _contextData5, null);
|
|
1175
|
+
}, "#destroyCollector");
|
|
1176
|
+
__name(_MentionableSelectMenuKit, "MentionableSelectMenuKit");
|
|
1177
|
+
MentionableSelectMenuKit = _MentionableSelectMenuKit;
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1181
|
+
// src/components/select-menu/UserSelectMenuKit.ts
|
|
1182
|
+
var import_discord9, _onSelectHandler4, _contextData6, _unsub6, _UserSelectMenuKit_instances, getEventInterceptor_fn6, setupCollector_fn5, destroyCollector_fn6, _UserSelectMenuKit, UserSelectMenuKit;
|
|
1183
|
+
var init_UserSelectMenuKit = __esm({
|
|
1184
|
+
"src/components/select-menu/UserSelectMenuKit.ts"() {
|
|
1185
|
+
"use strict";
|
|
1186
|
+
init_cjs_shims();
|
|
1187
|
+
import_discord9 = require("discord.js");
|
|
1188
|
+
init_async_context();
|
|
1189
|
+
_UserSelectMenuKit = class _UserSelectMenuKit extends import_discord9.UserSelectMenuBuilder {
|
|
1190
|
+
constructor() {
|
|
1191
|
+
super(...arguments);
|
|
1192
|
+
__privateAdd(this, _UserSelectMenuKit_instances);
|
|
1193
|
+
__privateAdd(this, _onSelectHandler4, null);
|
|
1194
|
+
__privateAdd(this, _contextData6, {
|
|
1195
|
+
autoReset: false,
|
|
1196
|
+
time: 5 * 60 * 1e3,
|
|
1197
|
+
once: true
|
|
1198
|
+
});
|
|
1199
|
+
__privateAdd(this, _unsub6, null);
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Sets the handler to run when the modal is submitted.
|
|
1203
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
1204
|
+
* @param data - The context data for the interaction collector.
|
|
1205
|
+
* @returns This instance of the modal builder.
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```ts
|
|
1208
|
+
* const modal = new UserSelectMenuKit()
|
|
1209
|
+
* .setTitle('My Modal')
|
|
1210
|
+
* .setCustomId('my-modal')
|
|
1211
|
+
* .filter((interaction) => interaction.user.id === '1234567890')
|
|
1212
|
+
* .onSelect(async (interaction) => {
|
|
1213
|
+
* await interaction.reply('You submitted the modal!');
|
|
1214
|
+
* })
|
|
1215
|
+
* .addComponents(actionRow1, actionRow2);
|
|
1216
|
+
* ```
|
|
1217
|
+
*/
|
|
1218
|
+
onSelect(handler, data) {
|
|
1219
|
+
var _a, _b, _c, _d;
|
|
1220
|
+
if (!handler) {
|
|
1221
|
+
throw new TypeError(
|
|
1222
|
+
'Cannot setup "onClick" without a handler function parameter.'
|
|
1223
|
+
);
|
|
1224
|
+
}
|
|
1225
|
+
if (__privateGet(this, _onSelectHandler4)) {
|
|
1226
|
+
__privateMethod(this, _UserSelectMenuKit_instances, destroyCollector_fn6).call(this);
|
|
1227
|
+
}
|
|
1228
|
+
__privateSet(this, _onSelectHandler4, handler);
|
|
1229
|
+
if (data) {
|
|
1230
|
+
__privateSet(this, _contextData6, {
|
|
1231
|
+
autoReset: data.autoReset ?? ((_a = __privateGet(this, _contextData6)) == null ? void 0 : _a.autoReset) ?? true,
|
|
1232
|
+
time: data.time ?? ((_b = __privateGet(this, _contextData6)) == null ? void 0 : _b.time) ?? 5 * 60 * 1e3,
|
|
1233
|
+
filter: data.filter ?? ((_c = __privateGet(this, _contextData6)) == null ? void 0 : _c.filter),
|
|
1234
|
+
onEnd: data.onEnd ?? ((_d = __privateGet(this, _contextData6)) == null ? void 0 : _d.onEnd)
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
__privateMethod(this, _UserSelectMenuKit_instances, setupCollector_fn5).call(this);
|
|
1238
|
+
return this;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Sets the handler to run when the interaction collector ends.
|
|
1242
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
1243
|
+
* @returns This instance of the modal builder.
|
|
1244
|
+
*/
|
|
1245
|
+
onEnd(handler) {
|
|
1246
|
+
if (!handler) {
|
|
1247
|
+
throw new TypeError(
|
|
1248
|
+
'Cannot setup "onEnd" without a handler function parameter.'
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
__privateGet(this, _contextData6) ?? __privateSet(this, _contextData6, {});
|
|
1252
|
+
__privateGet(this, _contextData6).onEnd = handler;
|
|
1253
|
+
return this;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Sets the handler to run when the interaction collector ends.
|
|
1257
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
1258
|
+
* @returns This instance of the modal builder.
|
|
1259
|
+
*/
|
|
1260
|
+
onError(handler) {
|
|
1261
|
+
if (!handler) {
|
|
1262
|
+
throw new TypeError(
|
|
1263
|
+
'Cannot setup "onError" without a handler function parameter.'
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
__privateGet(this, _contextData6) ?? __privateSet(this, _contextData6, {});
|
|
1267
|
+
__privateGet(this, _contextData6).onError = handler;
|
|
1268
|
+
return this;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Sets a filter for the interaction collector.
|
|
1272
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
1273
|
+
* @returns This instance of the modal builder.
|
|
1274
|
+
*/
|
|
1275
|
+
filter(predicate) {
|
|
1276
|
+
__privateGet(this, _contextData6) ?? __privateSet(this, _contextData6, {
|
|
1277
|
+
autoReset: true,
|
|
1278
|
+
time: 5 * 60 * 1e3
|
|
1279
|
+
});
|
|
1280
|
+
__privateGet(this, _contextData6).filter = predicate;
|
|
1281
|
+
return this;
|
|
1282
|
+
}
|
|
1283
|
+
get customId() {
|
|
1284
|
+
return this.data.custom_id ?? this.data.customId;
|
|
1285
|
+
}
|
|
1286
|
+
dispose() {
|
|
1287
|
+
__privateMethod(this, _UserSelectMenuKit_instances, destroyCollector_fn6).call(this);
|
|
1288
|
+
return this;
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
_onSelectHandler4 = new WeakMap();
|
|
1292
|
+
_contextData6 = new WeakMap();
|
|
1293
|
+
_unsub6 = new WeakMap();
|
|
1294
|
+
_UserSelectMenuKit_instances = new WeakSet();
|
|
1295
|
+
getEventInterceptor_fn6 = /* @__PURE__ */ __name(function() {
|
|
1296
|
+
const ctx = getContext();
|
|
1297
|
+
if (!ctx) return getCommandKit(true).eventInterceptor;
|
|
1298
|
+
return exitContext(() => ctx.commandkit.eventInterceptor);
|
|
1299
|
+
}, "#getEventInterceptor");
|
|
1300
|
+
setupCollector_fn5 = /* @__PURE__ */ __name(function() {
|
|
1301
|
+
if (!__privateGet(this, _contextData6)) return;
|
|
1302
|
+
if (!this.customId) {
|
|
1303
|
+
throw new TypeError(
|
|
1304
|
+
"Cannot setup an modal collector without a custom ID."
|
|
1305
|
+
);
|
|
1306
|
+
}
|
|
1307
|
+
const interceptor = __privateMethod(this, _UserSelectMenuKit_instances, getEventInterceptor_fn6).call(this);
|
|
1308
|
+
if (!interceptor) return;
|
|
1309
|
+
__privateSet(this, _unsub6, interceptor.subscribe(
|
|
1310
|
+
import_discord9.Events.InteractionCreate,
|
|
1311
|
+
async (interaction) => {
|
|
1312
|
+
var _a, _b;
|
|
1313
|
+
if (!interaction.isUserSelectMenu()) return;
|
|
1314
|
+
const myCustomId = this.customId ?? null;
|
|
1315
|
+
const interactionCustomId = interaction.customId;
|
|
1316
|
+
if (myCustomId && interactionCustomId !== myCustomId) return;
|
|
1317
|
+
const filter = (_a = __privateGet(this, _contextData6)) == null ? void 0 : _a.filter;
|
|
1318
|
+
if (filter && !await filter(interaction)) return;
|
|
1319
|
+
const handler = __privateGet(this, _onSelectHandler4);
|
|
1320
|
+
if (!handler) return (_b = __privateGet(this, _unsub6)) == null ? void 0 : _b.call(this);
|
|
1321
|
+
return handler(interaction, this);
|
|
1322
|
+
},
|
|
1323
|
+
__privateGet(this, _contextData6)
|
|
1324
|
+
));
|
|
1325
|
+
}, "#setupCollector");
|
|
1326
|
+
destroyCollector_fn6 = /* @__PURE__ */ __name(function() {
|
|
1327
|
+
var _a;
|
|
1328
|
+
(_a = __privateGet(this, _unsub6)) == null ? void 0 : _a.call(this);
|
|
1329
|
+
__privateSet(this, _unsub6, null);
|
|
1330
|
+
__privateSet(this, _onSelectHandler4, null);
|
|
1331
|
+
__privateSet(this, _contextData6, null);
|
|
1332
|
+
}, "#destroyCollector");
|
|
1333
|
+
__name(_UserSelectMenuKit, "UserSelectMenuKit");
|
|
1334
|
+
UserSelectMenuKit = _UserSelectMenuKit;
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
|
|
1338
|
+
// src/components/select-menu/RoleSelectMenuKit.ts
|
|
1339
|
+
var import_discord10, _onSelectHandler5, _contextData7, _unsub7, _RoleSelectMenuKit_instances, getEventInterceptor_fn7, setupCollector_fn6, destroyCollector_fn7, _RoleSelectMenuKit, RoleSelectMenuKit;
|
|
1340
|
+
var init_RoleSelectMenuKit = __esm({
|
|
1341
|
+
"src/components/select-menu/RoleSelectMenuKit.ts"() {
|
|
1342
|
+
"use strict";
|
|
1343
|
+
init_cjs_shims();
|
|
1344
|
+
import_discord10 = require("discord.js");
|
|
1345
|
+
init_async_context();
|
|
1346
|
+
_RoleSelectMenuKit = class _RoleSelectMenuKit extends import_discord10.RoleSelectMenuBuilder {
|
|
1347
|
+
constructor() {
|
|
1348
|
+
super(...arguments);
|
|
1349
|
+
__privateAdd(this, _RoleSelectMenuKit_instances);
|
|
1350
|
+
__privateAdd(this, _onSelectHandler5, null);
|
|
1351
|
+
__privateAdd(this, _contextData7, {
|
|
1352
|
+
autoReset: false,
|
|
1353
|
+
time: 5 * 60 * 1e3,
|
|
1354
|
+
once: true
|
|
1355
|
+
});
|
|
1356
|
+
__privateAdd(this, _unsub7, null);
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Sets the handler to run when the modal is submitted.
|
|
1360
|
+
* @param handler - The handler to run when the modal is submitted.
|
|
1361
|
+
* @param data - The context data for the interaction collector.
|
|
1362
|
+
* @returns This instance of the modal builder.
|
|
1363
|
+
* @example
|
|
1364
|
+
* ```ts
|
|
1365
|
+
* const modal = new RoleSelectMenuKit()
|
|
1366
|
+
* .setTitle('My Modal')
|
|
1367
|
+
* .setCustomId('my-modal')
|
|
1368
|
+
* .filter((interaction) => interaction.Role.id === '1234567890')
|
|
1369
|
+
* .onSelect(async (interaction) => {
|
|
1370
|
+
* await interaction.reply('You submitted the modal!');
|
|
1371
|
+
* })
|
|
1372
|
+
* .addComponents(actionRow1, actionRow2);
|
|
1373
|
+
* ```
|
|
1374
|
+
*/
|
|
1375
|
+
onSelect(handler, data) {
|
|
1376
|
+
var _a, _b, _c, _d;
|
|
1377
|
+
if (!handler) {
|
|
1378
|
+
throw new TypeError(
|
|
1379
|
+
'Cannot setup "onClick" without a handler function parameter.'
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
if (__privateGet(this, _onSelectHandler5)) {
|
|
1383
|
+
__privateMethod(this, _RoleSelectMenuKit_instances, destroyCollector_fn7).call(this);
|
|
1384
|
+
}
|
|
1385
|
+
__privateSet(this, _onSelectHandler5, handler);
|
|
1386
|
+
if (data) {
|
|
1387
|
+
__privateSet(this, _contextData7, {
|
|
1388
|
+
autoReset: data.autoReset ?? ((_a = __privateGet(this, _contextData7)) == null ? void 0 : _a.autoReset) ?? true,
|
|
1389
|
+
time: data.time ?? ((_b = __privateGet(this, _contextData7)) == null ? void 0 : _b.time) ?? 5 * 60 * 1e3,
|
|
1390
|
+
filter: data.filter ?? ((_c = __privateGet(this, _contextData7)) == null ? void 0 : _c.filter),
|
|
1391
|
+
onEnd: data.onEnd ?? ((_d = __privateGet(this, _contextData7)) == null ? void 0 : _d.onEnd)
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
__privateMethod(this, _RoleSelectMenuKit_instances, setupCollector_fn6).call(this);
|
|
1395
|
+
return this;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Sets the handler to run when the interaction collector ends.
|
|
1399
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
1400
|
+
* @returns This instance of the modal builder.
|
|
1401
|
+
*/
|
|
1402
|
+
onEnd(handler) {
|
|
1403
|
+
if (!handler) {
|
|
1404
|
+
throw new TypeError(
|
|
1405
|
+
'Cannot setup "onEnd" without a handler function parameter.'
|
|
1406
|
+
);
|
|
1407
|
+
}
|
|
1408
|
+
__privateGet(this, _contextData7) ?? __privateSet(this, _contextData7, {});
|
|
1409
|
+
__privateGet(this, _contextData7).onEnd = handler;
|
|
1410
|
+
return this;
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Sets the handler to run when the interaction collector ends.
|
|
1414
|
+
* @param handler - The handler to run when the interaction collector ends.
|
|
1415
|
+
* @returns This instance of the modal builder.
|
|
1416
|
+
*/
|
|
1417
|
+
onError(handler) {
|
|
1418
|
+
if (!handler) {
|
|
1419
|
+
throw new TypeError(
|
|
1420
|
+
'Cannot setup "onError" without a handler function parameter.'
|
|
1421
|
+
);
|
|
1422
|
+
}
|
|
1423
|
+
__privateGet(this, _contextData7) ?? __privateSet(this, _contextData7, {});
|
|
1424
|
+
__privateGet(this, _contextData7).onError = handler;
|
|
1425
|
+
return this;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Sets a filter for the interaction collector.
|
|
1429
|
+
* @param predicate - The filter to use for the interaction collector.
|
|
1430
|
+
* @returns This instance of the modal builder.
|
|
1431
|
+
*/
|
|
1432
|
+
filter(predicate) {
|
|
1433
|
+
__privateGet(this, _contextData7) ?? __privateSet(this, _contextData7, {
|
|
1434
|
+
autoReset: true,
|
|
1435
|
+
time: 5 * 60 * 1e3
|
|
1436
|
+
});
|
|
1437
|
+
__privateGet(this, _contextData7).filter = predicate;
|
|
1438
|
+
return this;
|
|
1439
|
+
}
|
|
1440
|
+
get customId() {
|
|
1441
|
+
return this.data.custom_id ?? this.data.customId;
|
|
1442
|
+
}
|
|
1443
|
+
dispose() {
|
|
1444
|
+
__privateMethod(this, _RoleSelectMenuKit_instances, destroyCollector_fn7).call(this);
|
|
1445
|
+
return this;
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
_onSelectHandler5 = new WeakMap();
|
|
1449
|
+
_contextData7 = new WeakMap();
|
|
1450
|
+
_unsub7 = new WeakMap();
|
|
1451
|
+
_RoleSelectMenuKit_instances = new WeakSet();
|
|
1452
|
+
getEventInterceptor_fn7 = /* @__PURE__ */ __name(function() {
|
|
1453
|
+
const ctx = getContext();
|
|
1454
|
+
if (!ctx) return getCommandKit(true).eventInterceptor;
|
|
1455
|
+
return exitContext(() => ctx.commandkit.eventInterceptor);
|
|
1456
|
+
}, "#getEventInterceptor");
|
|
1457
|
+
setupCollector_fn6 = /* @__PURE__ */ __name(function() {
|
|
1458
|
+
if (!__privateGet(this, _contextData7)) return;
|
|
1459
|
+
if (!this.customId) {
|
|
1460
|
+
throw new TypeError(
|
|
1461
|
+
"Cannot setup an modal collector without a custom ID."
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
const interceptor = __privateMethod(this, _RoleSelectMenuKit_instances, getEventInterceptor_fn7).call(this);
|
|
1465
|
+
if (!interceptor) return;
|
|
1466
|
+
__privateSet(this, _unsub7, interceptor.subscribe(
|
|
1467
|
+
import_discord10.Events.InteractionCreate,
|
|
1468
|
+
async (interaction) => {
|
|
1469
|
+
var _a, _b;
|
|
1470
|
+
if (!interaction.isRoleSelectMenu()) return;
|
|
1471
|
+
const myCustomId = this.customId ?? null;
|
|
1472
|
+
const interactionCustomId = interaction.customId;
|
|
1473
|
+
if (myCustomId && interactionCustomId !== myCustomId) return;
|
|
1474
|
+
const filter = (_a = __privateGet(this, _contextData7)) == null ? void 0 : _a.filter;
|
|
1475
|
+
if (filter && !await filter(interaction)) return;
|
|
1476
|
+
const handler = __privateGet(this, _onSelectHandler5);
|
|
1477
|
+
if (!handler) return (_b = __privateGet(this, _unsub7)) == null ? void 0 : _b.call(this);
|
|
1478
|
+
return handler(interaction, this);
|
|
1479
|
+
},
|
|
1480
|
+
__privateGet(this, _contextData7)
|
|
1481
|
+
));
|
|
1482
|
+
}, "#setupCollector");
|
|
1483
|
+
destroyCollector_fn7 = /* @__PURE__ */ __name(function() {
|
|
1484
|
+
var _a;
|
|
1485
|
+
(_a = __privateGet(this, _unsub7)) == null ? void 0 : _a.call(this);
|
|
1486
|
+
__privateSet(this, _unsub7, null);
|
|
1487
|
+
__privateSet(this, _onSelectHandler5, null);
|
|
1488
|
+
__privateSet(this, _contextData7, null);
|
|
1489
|
+
}, "#destroyCollector");
|
|
1490
|
+
__name(_RoleSelectMenuKit, "RoleSelectMenuKit");
|
|
1491
|
+
RoleSelectMenuKit = _RoleSelectMenuKit;
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
|
|
1495
|
+
// src/components/select-menu/SelectMenu.ts
|
|
1496
|
+
function applyPropsToBuilder(builder, props) {
|
|
1497
|
+
builder.setCustomId(props.customId ?? `select-menu::${crypto.randomUUID()}`);
|
|
1498
|
+
if (props.maxValues != null) {
|
|
1499
|
+
builder.setMaxValues(props.maxValues);
|
|
1500
|
+
}
|
|
1501
|
+
if (props.minValues != null) {
|
|
1502
|
+
builder.setMinValues(props.minValues);
|
|
1503
|
+
}
|
|
1504
|
+
if (props.placeholder) {
|
|
1505
|
+
builder.setPlaceholder(props.placeholder);
|
|
1506
|
+
}
|
|
1507
|
+
if (props.disabled) {
|
|
1508
|
+
builder.setDisabled(props.disabled);
|
|
1509
|
+
}
|
|
1510
|
+
if (props.onEnd) {
|
|
1511
|
+
builder.onEnd(props.onEnd);
|
|
1512
|
+
}
|
|
1513
|
+
if (props.onError) {
|
|
1514
|
+
builder.onError(props.onError);
|
|
1515
|
+
}
|
|
1516
|
+
if (props.onSelect) {
|
|
1517
|
+
builder.onSelect(props.onSelect, props.options);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
function StringSelectMenu(props) {
|
|
1521
|
+
const builder = new StringSelectMenuKit();
|
|
1522
|
+
applyPropsToBuilder(builder, props);
|
|
1523
|
+
if (props.children) {
|
|
1524
|
+
builder.setOptions(
|
|
1525
|
+
Array.isArray(props.children) ? props.children : [props.children]
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
if (props.children) {
|
|
1529
|
+
builder.setOptions(
|
|
1530
|
+
Array.isArray(props.children) ? props.children : [props.children]
|
|
1531
|
+
);
|
|
1532
|
+
}
|
|
1533
|
+
return builder;
|
|
1534
|
+
}
|
|
1535
|
+
function StringSelectMenuOption(props) {
|
|
1536
|
+
return new import_discord11.StringSelectMenuOptionBuilder(props);
|
|
1537
|
+
}
|
|
1538
|
+
function UserSelectMenu(props) {
|
|
1539
|
+
const builder = new UserSelectMenuKit();
|
|
1540
|
+
applyPropsToBuilder(builder, props);
|
|
1541
|
+
if (props.defaultValues) {
|
|
1542
|
+
builder.setDefaultUsers(
|
|
1543
|
+
Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
return builder;
|
|
1547
|
+
}
|
|
1548
|
+
function RoleSelectMenu(props) {
|
|
1549
|
+
const builder = new RoleSelectMenuKit();
|
|
1550
|
+
applyPropsToBuilder(builder, props);
|
|
1551
|
+
if (props.defaultValues) {
|
|
1552
|
+
builder.setDefaultRoles(
|
|
1553
|
+
Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]
|
|
1554
|
+
);
|
|
1555
|
+
}
|
|
1556
|
+
return builder;
|
|
1557
|
+
}
|
|
1558
|
+
function MentionableSelectMenu(props) {
|
|
1559
|
+
const builder = new MentionableSelectMenuKit();
|
|
1560
|
+
applyPropsToBuilder(builder, props);
|
|
1561
|
+
if (props.defaultValues) {
|
|
1562
|
+
builder.setDefaultValues(
|
|
1563
|
+
Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
return builder;
|
|
1567
|
+
}
|
|
1568
|
+
function ChannelSelectMenu(props) {
|
|
1569
|
+
const builder = new ChannelSelectMenuKit();
|
|
1570
|
+
applyPropsToBuilder(builder, props);
|
|
1571
|
+
if (props.defaultValues) {
|
|
1572
|
+
builder.setDefaultChannels(
|
|
1573
|
+
Array.isArray(props.defaultValues) ? props.defaultValues : [props.defaultValues]
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
if (props.channelTypes) {
|
|
1577
|
+
builder.setChannelTypes(
|
|
1578
|
+
Array.isArray(props.channelTypes) ? props.channelTypes : [props.channelTypes]
|
|
1579
|
+
);
|
|
1580
|
+
}
|
|
1581
|
+
return builder;
|
|
1582
|
+
}
|
|
1583
|
+
var import_discord11;
|
|
1584
|
+
var init_SelectMenu = __esm({
|
|
1585
|
+
"src/components/select-menu/SelectMenu.ts"() {
|
|
1586
|
+
"use strict";
|
|
1587
|
+
init_cjs_shims();
|
|
1588
|
+
import_discord11 = require("discord.js");
|
|
1589
|
+
init_ChannelSelectMenuKit();
|
|
1590
|
+
init_MentionableSelectMenuKit();
|
|
1591
|
+
init_RoleSelectMenuKit();
|
|
1592
|
+
init_StringSelectMenuKit();
|
|
1593
|
+
init_UserSelectMenuKit();
|
|
1594
|
+
__name(applyPropsToBuilder, "applyPropsToBuilder");
|
|
1595
|
+
__name(StringSelectMenu, "StringSelectMenu");
|
|
1596
|
+
__name(StringSelectMenuOption, "StringSelectMenuOption");
|
|
1597
|
+
__name(UserSelectMenu, "UserSelectMenu");
|
|
1598
|
+
__name(RoleSelectMenu, "RoleSelectMenu");
|
|
1599
|
+
__name(MentionableSelectMenu, "MentionableSelectMenu");
|
|
1600
|
+
__name(ChannelSelectMenu, "ChannelSelectMenu");
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
// src/components/select-menu/common.ts
|
|
1605
|
+
var init_common = __esm({
|
|
1606
|
+
"src/components/select-menu/common.ts"() {
|
|
1607
|
+
"use strict";
|
|
1608
|
+
init_cjs_shims();
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
|
|
710
1612
|
// src/utils/warn-unstable.ts
|
|
711
1613
|
function emitWarning(message, code = "CommandKitWarning") {
|
|
712
1614
|
process.emitWarning(message, { code });
|
|
@@ -956,6 +1858,13 @@ var init_components = __esm({
|
|
|
956
1858
|
init_Button();
|
|
957
1859
|
init_ModalKit();
|
|
958
1860
|
init_Modal();
|
|
1861
|
+
init_StringSelectMenuKit();
|
|
1862
|
+
init_ChannelSelectMenuKit();
|
|
1863
|
+
init_MentionableSelectMenuKit();
|
|
1864
|
+
init_UserSelectMenuKit();
|
|
1865
|
+
init_RoleSelectMenuKit();
|
|
1866
|
+
init_SelectMenu();
|
|
1867
|
+
init_common();
|
|
959
1868
|
init_element();
|
|
960
1869
|
init_types();
|
|
961
1870
|
init_EventInterceptor();
|
|
@@ -1281,19 +2190,19 @@ var init_Logger = __esm({
|
|
|
1281
2190
|
});
|
|
1282
2191
|
|
|
1283
2192
|
// src/plugins/runtime/CommandKitPluginRuntime.ts
|
|
1284
|
-
var
|
|
2193
|
+
var import_discord12, _CommandKitPluginRuntime, CommandKitPluginRuntime;
|
|
1285
2194
|
var init_CommandKitPluginRuntime = __esm({
|
|
1286
2195
|
"src/plugins/runtime/CommandKitPluginRuntime.ts"() {
|
|
1287
2196
|
"use strict";
|
|
1288
2197
|
init_cjs_shims();
|
|
1289
|
-
|
|
2198
|
+
import_discord12 = require("discord.js");
|
|
1290
2199
|
init_error_codes();
|
|
1291
2200
|
init_Logger();
|
|
1292
2201
|
_CommandKitPluginRuntime = class _CommandKitPluginRuntime {
|
|
1293
2202
|
constructor(commandkit2) {
|
|
1294
2203
|
this.commandkit = commandkit2;
|
|
1295
2204
|
}
|
|
1296
|
-
plugins = new
|
|
2205
|
+
plugins = new import_discord12.Collection();
|
|
1297
2206
|
getPlugin(pluginName) {
|
|
1298
2207
|
return this.plugins.get(pluginName) ?? null;
|
|
1299
2208
|
}
|
|
@@ -2119,12 +3028,12 @@ var init_resolve_file_url = __esm({
|
|
|
2119
3028
|
});
|
|
2120
3029
|
|
|
2121
3030
|
// src/app/commands/MessageCommandParser.ts
|
|
2122
|
-
var
|
|
3031
|
+
var import_discord13, _parsed, _options, _args, _MessageCommandParser, MessageCommandParser, _MessageCommandOptions, MessageCommandOptions;
|
|
2123
3032
|
var init_MessageCommandParser = __esm({
|
|
2124
3033
|
"src/app/commands/MessageCommandParser.ts"() {
|
|
2125
3034
|
"use strict";
|
|
2126
3035
|
init_cjs_shims();
|
|
2127
|
-
|
|
3036
|
+
import_discord13 = require("discord.js");
|
|
2128
3037
|
init_error_codes();
|
|
2129
3038
|
_MessageCommandParser = class _MessageCommandParser {
|
|
2130
3039
|
constructor(message, prefix, schema) {
|
|
@@ -2199,36 +3108,36 @@ var init_MessageCommandParser = __esm({
|
|
|
2199
3108
|
const [name, value] = part.split(":");
|
|
2200
3109
|
if (!(name in schema)) return null;
|
|
2201
3110
|
switch (schema[name]) {
|
|
2202
|
-
case
|
|
3111
|
+
case import_discord13.ApplicationCommandOptionType.Boolean:
|
|
2203
3112
|
return { name, value: value === "true" };
|
|
2204
|
-
case
|
|
3113
|
+
case import_discord13.ApplicationCommandOptionType.Integer:
|
|
2205
3114
|
return { name, value: parseInt(value, 10) };
|
|
2206
|
-
case
|
|
3115
|
+
case import_discord13.ApplicationCommandOptionType.Number:
|
|
2207
3116
|
return { name, value: parseFloat(value) };
|
|
2208
|
-
case
|
|
3117
|
+
case import_discord13.ApplicationCommandOptionType.String:
|
|
2209
3118
|
return { name, value };
|
|
2210
|
-
case
|
|
3119
|
+
case import_discord13.ApplicationCommandOptionType.User:
|
|
2211
3120
|
return {
|
|
2212
3121
|
name,
|
|
2213
3122
|
value: this.message.mentions.users.find((u) => {
|
|
2214
3123
|
return u.id === value.replace(/[<@!>]/g, "");
|
|
2215
3124
|
})
|
|
2216
3125
|
};
|
|
2217
|
-
case
|
|
3126
|
+
case import_discord13.ApplicationCommandOptionType.Channel:
|
|
2218
3127
|
return {
|
|
2219
3128
|
name,
|
|
2220
3129
|
value: this.message.mentions.channels.find((c) => {
|
|
2221
3130
|
return c.id === value.replace(/[<#>]/g, "");
|
|
2222
3131
|
})
|
|
2223
3132
|
};
|
|
2224
|
-
case
|
|
3133
|
+
case import_discord13.ApplicationCommandOptionType.Role:
|
|
2225
3134
|
return {
|
|
2226
3135
|
name,
|
|
2227
3136
|
value: this.message.mentions.roles.find((r) => {
|
|
2228
3137
|
return r.id === value.replace(/[<@&>]/g, "");
|
|
2229
3138
|
})
|
|
2230
3139
|
};
|
|
2231
|
-
case
|
|
3140
|
+
case import_discord13.ApplicationCommandOptionType.Attachment:
|
|
2232
3141
|
return {
|
|
2233
3142
|
name,
|
|
2234
3143
|
value: this.message.attachments.find((a) => {
|
|
@@ -2302,7 +3211,7 @@ var init_MessageCommandParser = __esm({
|
|
|
2302
3211
|
}
|
|
2303
3212
|
getMentionable(name, required = false) {
|
|
2304
3213
|
const target = this.assertOption(name, required);
|
|
2305
|
-
if (target instanceof
|
|
3214
|
+
if (target instanceof import_discord13.GuildMember || target instanceof import_discord13.User || target instanceof import_discord13.Role) {
|
|
2306
3215
|
return target;
|
|
2307
3216
|
}
|
|
2308
3217
|
if (required) {
|
|
@@ -2331,12 +3240,12 @@ var init_MessageCommandParser = __esm({
|
|
|
2331
3240
|
});
|
|
2332
3241
|
|
|
2333
3242
|
// src/app/register/CommandRegistrar.ts
|
|
2334
|
-
var
|
|
3243
|
+
var import_discord14, _CommandRegistrar, CommandRegistrar;
|
|
2335
3244
|
var init_CommandRegistrar = __esm({
|
|
2336
3245
|
"src/app/register/CommandRegistrar.ts"() {
|
|
2337
3246
|
"use strict";
|
|
2338
3247
|
init_cjs_shims();
|
|
2339
|
-
|
|
3248
|
+
import_discord14 = require("discord.js");
|
|
2340
3249
|
init_Logger();
|
|
2341
3250
|
_CommandRegistrar = class _CommandRegistrar {
|
|
2342
3251
|
/**
|
|
@@ -2349,7 +3258,7 @@ var init_CommandRegistrar = __esm({
|
|
|
2349
3258
|
this.commandkit.client.token ?? process.env.DISCORD_TOKEN ?? process.env.TOKEN ?? ""
|
|
2350
3259
|
);
|
|
2351
3260
|
}
|
|
2352
|
-
api = new
|
|
3261
|
+
api = new import_discord14.REST();
|
|
2353
3262
|
/**
|
|
2354
3263
|
* Gets the commands data.
|
|
2355
3264
|
*/
|
|
@@ -2359,20 +3268,20 @@ var init_CommandRegistrar = __esm({
|
|
|
2359
3268
|
return commands.flatMap((cmd) => {
|
|
2360
3269
|
const json = "toJSON" in cmd.data.command ? cmd.data.command.toJSON() : cmd.data.command;
|
|
2361
3270
|
const collections = [json];
|
|
2362
|
-
if (cmd.data.userContextMenu && json.type !==
|
|
3271
|
+
if (cmd.data.userContextMenu && json.type !== import_discord14.ApplicationCommandType.User) {
|
|
2363
3272
|
collections.push({
|
|
2364
3273
|
...json,
|
|
2365
|
-
type:
|
|
3274
|
+
type: import_discord14.ApplicationCommandType.User,
|
|
2366
3275
|
options: void 0,
|
|
2367
3276
|
description_localizations: void 0,
|
|
2368
3277
|
// @ts-ignore
|
|
2369
3278
|
description: void 0
|
|
2370
3279
|
});
|
|
2371
3280
|
}
|
|
2372
|
-
if (cmd.data.messageContextMenu && json.type !==
|
|
3281
|
+
if (cmd.data.messageContextMenu && json.type !== import_discord14.ApplicationCommandType.Message) {
|
|
2373
3282
|
collections.push({
|
|
2374
3283
|
...json,
|
|
2375
|
-
type:
|
|
3284
|
+
type: import_discord14.ApplicationCommandType.Message,
|
|
2376
3285
|
description_localizations: void 0,
|
|
2377
3286
|
// @ts-ignore
|
|
2378
3287
|
description: void 0,
|
|
@@ -2416,7 +3325,7 @@ var init_CommandRegistrar = __esm({
|
|
|
2416
3325
|
if (!commands.length) return;
|
|
2417
3326
|
try {
|
|
2418
3327
|
const data = await this.api.put(
|
|
2419
|
-
|
|
3328
|
+
import_discord14.Routes.applicationCommands(this.commandkit.client.user.id),
|
|
2420
3329
|
{
|
|
2421
3330
|
body: commands.map((c) => ({
|
|
2422
3331
|
...c,
|
|
@@ -2451,7 +3360,7 @@ var init_CommandRegistrar = __esm({
|
|
|
2451
3360
|
let count = 0;
|
|
2452
3361
|
for (const [guild, guildCommands] of guildCommandsMap) {
|
|
2453
3362
|
const data = await this.api.put(
|
|
2454
|
-
|
|
3363
|
+
import_discord14.Routes.applicationGuildCommands(
|
|
2455
3364
|
this.commandkit.client.user.id,
|
|
2456
3365
|
guild
|
|
2457
3366
|
),
|
|
@@ -3188,12 +4097,12 @@ var init_Context = __esm({
|
|
|
3188
4097
|
});
|
|
3189
4098
|
|
|
3190
4099
|
// src/app/commands/AppCommandRunner.ts
|
|
3191
|
-
var
|
|
4100
|
+
var import_discord15, _AppCommandRunner_instances, finalizer_fn, _AppCommandRunner, AppCommandRunner;
|
|
3192
4101
|
var init_AppCommandRunner = __esm({
|
|
3193
4102
|
"src/app/commands/AppCommandRunner.ts"() {
|
|
3194
4103
|
"use strict";
|
|
3195
4104
|
init_cjs_shims();
|
|
3196
|
-
|
|
4105
|
+
import_discord15 = require("discord.js");
|
|
3197
4106
|
init_environment();
|
|
3198
4107
|
init_Logger();
|
|
3199
4108
|
init_Context();
|
|
@@ -3205,7 +4114,7 @@ var init_AppCommandRunner = __esm({
|
|
|
3205
4114
|
__privateAdd(this, _AppCommandRunner_instances);
|
|
3206
4115
|
}
|
|
3207
4116
|
async runCommand(prepared, source) {
|
|
3208
|
-
if (source instanceof
|
|
4117
|
+
if (source instanceof import_discord15.Message && (source.editedTimestamp || source.partial)) {
|
|
3209
4118
|
return;
|
|
3210
4119
|
}
|
|
3211
4120
|
const { commandkit: commandkit2 } = this.handler;
|
|
@@ -3219,8 +4128,8 @@ var init_AppCommandRunner = __esm({
|
|
|
3219
4128
|
const ctx = new MiddlewareContext(commandkit2, {
|
|
3220
4129
|
environment: env,
|
|
3221
4130
|
executionMode,
|
|
3222
|
-
interaction: !(source instanceof
|
|
3223
|
-
message: source instanceof
|
|
4131
|
+
interaction: !(source instanceof import_discord15.Message) ? source : null,
|
|
4132
|
+
message: source instanceof import_discord15.Message ? source : null,
|
|
3224
4133
|
forwarded: false,
|
|
3225
4134
|
customArgs: {
|
|
3226
4135
|
setCommandRunner: /* @__PURE__ */ __name((fn) => {
|
|
@@ -3325,7 +4234,7 @@ var init_AppCommandRunner = __esm({
|
|
|
3325
4234
|
}
|
|
3326
4235
|
}
|
|
3327
4236
|
getExecutionMode(source) {
|
|
3328
|
-
if (source instanceof
|
|
4237
|
+
if (source instanceof import_discord15.Message) return CommandExecutionMode.Message;
|
|
3329
4238
|
if (source.isChatInputCommand()) return CommandExecutionMode.SlashCommand;
|
|
3330
4239
|
if (source.isAutocomplete()) {
|
|
3331
4240
|
return CommandExecutionMode.Autocomplete;
|
|
@@ -3423,12 +4332,12 @@ var init_types_package = __esm({
|
|
|
3423
4332
|
});
|
|
3424
4333
|
|
|
3425
4334
|
// src/app/handlers/AppCommandHandler.ts
|
|
3426
|
-
var
|
|
4335
|
+
var import_discord16, commandDataSchema, middlewareDataSchema, _AppCommandHandler, AppCommandHandler;
|
|
3427
4336
|
var init_AppCommandHandler = __esm({
|
|
3428
4337
|
"src/app/handlers/AppCommandHandler.ts"() {
|
|
3429
4338
|
"use strict";
|
|
3430
4339
|
init_cjs_shims();
|
|
3431
|
-
|
|
4340
|
+
import_discord16 = require("discord.js");
|
|
3432
4341
|
init_resolve_file_url();
|
|
3433
4342
|
init_MessageCommandParser();
|
|
3434
4343
|
init_error_codes();
|
|
@@ -3439,7 +4348,7 @@ var init_AppCommandHandler = __esm({
|
|
|
3439
4348
|
init_types_package();
|
|
3440
4349
|
init_colors();
|
|
3441
4350
|
commandDataSchema = {
|
|
3442
|
-
command: /* @__PURE__ */ __name((c) => c instanceof
|
|
4351
|
+
command: /* @__PURE__ */ __name((c) => c instanceof import_discord16.SlashCommandBuilder || c instanceof import_discord16.ContextMenuCommandBuilder || c && typeof c === "object", "command"),
|
|
3443
4352
|
chatInput: /* @__PURE__ */ __name((c) => typeof c === "function", "chatInput"),
|
|
3444
4353
|
autocomplete: /* @__PURE__ */ __name((c) => typeof c === "function", "autocomplete"),
|
|
3445
4354
|
message: /* @__PURE__ */ __name((c) => typeof c === "function", "message"),
|
|
@@ -3455,8 +4364,8 @@ var init_AppCommandHandler = __esm({
|
|
|
3455
4364
|
this.commandkit = commandkit2;
|
|
3456
4365
|
this.registrar = new CommandRegistrar(this.commandkit);
|
|
3457
4366
|
}
|
|
3458
|
-
loadedCommands = new
|
|
3459
|
-
loadedMiddlewares = new
|
|
4367
|
+
loadedCommands = new import_discord16.Collection();
|
|
4368
|
+
loadedMiddlewares = new import_discord16.Collection();
|
|
3460
4369
|
// Name-to-ID mapping for easier lookup
|
|
3461
4370
|
commandNameToId = /* @__PURE__ */ new Map();
|
|
3462
4371
|
subcommandPathToId = /* @__PURE__ */ new Map();
|
|
@@ -3546,15 +4455,15 @@ var init_AppCommandHandler = __esm({
|
|
|
3546
4455
|
if (!prepared) return;
|
|
3547
4456
|
return this.commandRunner.runCommand(prepared, newMessage);
|
|
3548
4457
|
};
|
|
3549
|
-
this.commandkit.client.on(
|
|
3550
|
-
this.commandkit.client.on(
|
|
3551
|
-
this.commandkit.client.on(
|
|
4458
|
+
this.commandkit.client.on(import_discord16.Events.InteractionCreate, this.onInteraction);
|
|
4459
|
+
this.commandkit.client.on(import_discord16.Events.MessageCreate, this.onMessageCreate);
|
|
4460
|
+
this.commandkit.client.on(import_discord16.Events.MessageUpdate, this.onMessageUpdate);
|
|
3552
4461
|
}
|
|
3553
4462
|
async prepareCommandRun(source, cmdName) {
|
|
3554
4463
|
var _a;
|
|
3555
4464
|
let parser2;
|
|
3556
4465
|
if (!cmdName) {
|
|
3557
|
-
if (source instanceof
|
|
4466
|
+
if (source instanceof import_discord16.Message) {
|
|
3558
4467
|
if (source.author.bot) return null;
|
|
3559
4468
|
const prefix = await this.commandkit.config.getMessageCommandPrefix(source);
|
|
3560
4469
|
parser2 = new MessageCommandParser(
|
|
@@ -3599,7 +4508,7 @@ var init_AppCommandHandler = __esm({
|
|
|
3599
4508
|
if (!commandId) return null;
|
|
3600
4509
|
const loadedCommand = this.loadedCommands.get(commandId);
|
|
3601
4510
|
if (!loadedCommand) return null;
|
|
3602
|
-
if (source instanceof
|
|
4511
|
+
if (source instanceof import_discord16.CommandInteraction && source.guildId && ((_a = loadedCommand.guilds) == null ? void 0 : _a.length) && !loadedCommand.guilds.includes(source.guildId)) {
|
|
3603
4512
|
return null;
|
|
3604
4513
|
}
|
|
3605
4514
|
const middlewares = [];
|
|
@@ -3718,7 +4627,7 @@ var init_AppCommandHandler = __esm({
|
|
|
3718
4627
|
async applyLocalizations(command) {
|
|
3719
4628
|
var _a, _b, _c, _d, _e;
|
|
3720
4629
|
const localization = this.commandkit.config.localizationStrategy;
|
|
3721
|
-
const validLocales = Object.values(
|
|
4630
|
+
const validLocales = Object.values(import_discord16.Locale).filter(
|
|
3722
4631
|
(v) => typeof v === "string"
|
|
3723
4632
|
);
|
|
3724
4633
|
const localizationKey = command.name;
|
|
@@ -3728,7 +4637,7 @@ var init_AppCommandHandler = __esm({
|
|
|
3728
4637
|
locale
|
|
3729
4638
|
);
|
|
3730
4639
|
if (!(translation == null ? void 0 : translation.command)) continue;
|
|
3731
|
-
if (command instanceof
|
|
4640
|
+
if (command instanceof import_discord16.SlashCommandBuilder) {
|
|
3732
4641
|
if (translation.command.name) {
|
|
3733
4642
|
command.setNameLocalization(locale, translation.command.name);
|
|
3734
4643
|
}
|
|
@@ -3774,7 +4683,7 @@ var init_AppCommandHandler = __esm({
|
|
|
3774
4683
|
});
|
|
3775
4684
|
}
|
|
3776
4685
|
}
|
|
3777
|
-
} else if (command instanceof
|
|
4686
|
+
} else if (command instanceof import_discord16.ContextMenuCommandBuilder) {
|
|
3778
4687
|
if (translation.command.name) {
|
|
3779
4688
|
command.setNameLocalization(locale, translation.command.name);
|
|
3780
4689
|
}
|
|
@@ -3829,24 +4738,24 @@ var init_AppCommandHandler = __esm({
|
|
|
3829
4738
|
});
|
|
3830
4739
|
|
|
3831
4740
|
// src/app/router/CommandsRouter.ts
|
|
3832
|
-
var
|
|
4741
|
+
var import_discord17, import_node_fs4, import_promises4, import_node_path4, MIDDLEWARE_PATTERN, COMMAND_PATTERN, CATEGORY_PATTERN, _CommandsRouter, CommandsRouter;
|
|
3833
4742
|
var init_CommandsRouter = __esm({
|
|
3834
4743
|
"src/app/router/CommandsRouter.ts"() {
|
|
3835
4744
|
"use strict";
|
|
3836
4745
|
init_cjs_shims();
|
|
3837
|
-
|
|
4746
|
+
import_discord17 = require("discord.js");
|
|
3838
4747
|
import_node_fs4 = require("fs");
|
|
3839
4748
|
import_promises4 = require("fs/promises");
|
|
3840
4749
|
import_node_path4 = require("path");
|
|
3841
4750
|
MIDDLEWARE_PATTERN = /^\+middleware\.(m|c)?(j|t)sx?$/;
|
|
3842
4751
|
COMMAND_PATTERN = /^([^+().][^().]*)\.(m|c)?(j|t)sx?$/;
|
|
3843
|
-
CATEGORY_PATTERN = /^\(
|
|
4752
|
+
CATEGORY_PATTERN = /^\(.+\)$/;
|
|
3844
4753
|
_CommandsRouter = class _CommandsRouter {
|
|
3845
4754
|
constructor(options) {
|
|
3846
4755
|
this.options = options;
|
|
3847
4756
|
}
|
|
3848
|
-
commands = new
|
|
3849
|
-
middlewares = new
|
|
4757
|
+
commands = new import_discord17.Collection();
|
|
4758
|
+
middlewares = new import_discord17.Collection();
|
|
3850
4759
|
populate(data) {
|
|
3851
4760
|
for (const [id, command] of Object.entries(data.commands)) {
|
|
3852
4761
|
this.commands.set(id, command);
|
|
@@ -3960,12 +4869,12 @@ var init_CommandsRouter = __esm({
|
|
|
3960
4869
|
});
|
|
3961
4870
|
|
|
3962
4871
|
// src/app/router/EventsRouter.ts
|
|
3963
|
-
var
|
|
4872
|
+
var import_discord18, import_node_fs5, import_promises5, import_node_path5, _EventsRouter, EventsRouter;
|
|
3964
4873
|
var init_EventsRouter = __esm({
|
|
3965
4874
|
"src/app/router/EventsRouter.ts"() {
|
|
3966
4875
|
"use strict";
|
|
3967
4876
|
init_cjs_shims();
|
|
3968
|
-
|
|
4877
|
+
import_discord18 = require("discord.js");
|
|
3969
4878
|
import_node_fs5 = require("fs");
|
|
3970
4879
|
import_promises5 = require("fs/promises");
|
|
3971
4880
|
import_node_path5 = require("path");
|
|
@@ -3982,7 +4891,7 @@ var init_EventsRouter = __esm({
|
|
|
3982
4891
|
}
|
|
3983
4892
|
}
|
|
3984
4893
|
/** Internal storage of parsed events */
|
|
3985
|
-
events = new
|
|
4894
|
+
events = new import_discord18.Collection();
|
|
3986
4895
|
/**
|
|
3987
4896
|
* Find a parsed event by its name
|
|
3988
4897
|
* @param event - Name of the event to find
|
|
@@ -4286,7 +5195,7 @@ async function ensureExists(loc) {
|
|
|
4286
5195
|
}
|
|
4287
5196
|
}
|
|
4288
5197
|
var import_rimraf, import_node_path6, import_node_fs6, ts;
|
|
4289
|
-
var
|
|
5198
|
+
var init_common2 = __esm({
|
|
4290
5199
|
"src/cli/common.ts"() {
|
|
4291
5200
|
"use strict";
|
|
4292
5201
|
init_cjs_shims();
|
|
@@ -4331,7 +5240,7 @@ var init_loader = __esm({
|
|
|
4331
5240
|
init_cjs_shims();
|
|
4332
5241
|
import_node_fs7 = require("fs");
|
|
4333
5242
|
import_node_path7 = require("path");
|
|
4334
|
-
|
|
5243
|
+
init_common2();
|
|
4335
5244
|
init_config();
|
|
4336
5245
|
CONFIG_FILE_NAMES = [
|
|
4337
5246
|
"commandkit.config.js",
|
|
@@ -4425,7 +5334,7 @@ var init_CommandKitEventsChannel = __esm({
|
|
|
4425
5334
|
});
|
|
4426
5335
|
|
|
4427
5336
|
// src/CommandKit.ts
|
|
4428
|
-
var import_node_events2,
|
|
5337
|
+
var import_node_events2, import_discord19, import_node_path8, import_node_fs8, commandkit, _started, _CommandKit_instances, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
|
|
4429
5338
|
var init_CommandKit = __esm({
|
|
4430
5339
|
"src/CommandKit.ts"() {
|
|
4431
5340
|
"use strict";
|
|
@@ -4436,7 +5345,7 @@ var init_CommandKit = __esm({
|
|
|
4436
5345
|
init_MemoryCache();
|
|
4437
5346
|
init_components();
|
|
4438
5347
|
init_EventInterceptor();
|
|
4439
|
-
|
|
5348
|
+
import_discord19 = require("discord.js");
|
|
4440
5349
|
init_DefaultLocalizationStrategy();
|
|
4441
5350
|
init_utilities();
|
|
4442
5351
|
import_node_path8 = require("path");
|
|
@@ -4479,7 +5388,7 @@ var init_CommandKit = __esm({
|
|
|
4479
5388
|
__privateAdd(this, _started, false);
|
|
4480
5389
|
__publicField(this, "eventInterceptor");
|
|
4481
5390
|
__publicField(this, "config", {
|
|
4482
|
-
defaultLocale:
|
|
5391
|
+
defaultLocale: import_discord19.Locale.EnglishUS,
|
|
4483
5392
|
localizationStrategy: new DefaultLocalizationStrategy(this),
|
|
4484
5393
|
getMessageCommandPrefix: /* @__PURE__ */ __name(() => "!", "getMessageCommandPrefix")
|
|
4485
5394
|
});
|
|
@@ -4520,7 +5429,7 @@ var init_CommandKit = __esm({
|
|
|
4520
5429
|
this.commandHandler.registerCommandHandler();
|
|
4521
5430
|
this.incrementClientListenersCount();
|
|
4522
5431
|
if (token !== false && !this.options.client.isReady()) {
|
|
4523
|
-
this.client.once(
|
|
5432
|
+
this.client.once(import_discord19.Events.ClientReady, async () => {
|
|
4524
5433
|
await this.commandHandler.registrar.register();
|
|
4525
5434
|
});
|
|
4526
5435
|
await this.plugins.execute((ctx, plugin) => {
|
|
@@ -4724,7 +5633,7 @@ var init_version = __esm({
|
|
|
4724
5633
|
"use strict";
|
|
4725
5634
|
init_cjs_shims();
|
|
4726
5635
|
version = /* @__MACRO__ $version */
|
|
4727
|
-
"0.1.11-dev.
|
|
5636
|
+
"0.1.11-dev.20250330115232";
|
|
4728
5637
|
}
|
|
4729
5638
|
});
|
|
4730
5639
|
|
|
@@ -4797,7 +5706,7 @@ var init_app_process = __esm({
|
|
|
4797
5706
|
init_env();
|
|
4798
5707
|
import_node_path9 = require("path");
|
|
4799
5708
|
import_node_fs9 = require("fs");
|
|
4800
|
-
|
|
5709
|
+
init_common2();
|
|
4801
5710
|
__name(getStdio, "getStdio");
|
|
4802
5711
|
__name(createAppProcess, "createAppProcess");
|
|
4803
5712
|
}
|
|
@@ -5136,7 +6045,7 @@ var init_production = __esm({
|
|
|
5136
6045
|
init_loader();
|
|
5137
6046
|
init_app_process();
|
|
5138
6047
|
import_fs = require("fs");
|
|
5139
|
-
|
|
6048
|
+
init_common2();
|
|
5140
6049
|
init_build();
|
|
5141
6050
|
init_plugins();
|
|
5142
6051
|
init_utils();
|
|
@@ -5203,7 +6112,7 @@ export default async function on${name[0].toUpperCase() + name.slice(1)}() {
|
|
|
5203
6112
|
}
|
|
5204
6113
|
async function generateLocale(locale, commandName, customPath) {
|
|
5205
6114
|
const localeNames = Object.fromEntries(
|
|
5206
|
-
Object.entries(
|
|
6115
|
+
Object.entries(import_discord21.Locale).map(([k, v]) => [v, k])
|
|
5207
6116
|
);
|
|
5208
6117
|
if (!localeNames[locale]) {
|
|
5209
6118
|
panic(`Invalid locale: ${locale}`);
|
|
@@ -5235,15 +6144,15 @@ async function generateLocale(locale, commandName, customPath) {
|
|
|
5235
6144
|
)
|
|
5236
6145
|
);
|
|
5237
6146
|
}
|
|
5238
|
-
var import_promises7, import_path4,
|
|
6147
|
+
var import_promises7, import_path4, import_discord21, import_fs2, BASE_PATH, COMMANDS_DIR, EVENTS_DIR, LOCALES_DIR, formatPath;
|
|
5239
6148
|
var init_generators = __esm({
|
|
5240
6149
|
"src/cli/generators.ts"() {
|
|
5241
6150
|
"use strict";
|
|
5242
6151
|
init_cjs_shims();
|
|
5243
6152
|
import_promises7 = require("fs/promises");
|
|
5244
6153
|
import_path4 = require("path");
|
|
5245
|
-
|
|
5246
|
-
|
|
6154
|
+
import_discord21 = require("discord.js");
|
|
6155
|
+
init_common2();
|
|
5247
6156
|
import_fs2 = require("fs");
|
|
5248
6157
|
init_colors();
|
|
5249
6158
|
BASE_PATH = process.cwd();
|
|
@@ -5265,6 +6174,8 @@ __export(index_exports, {
|
|
|
5265
6174
|
Button: () => Button,
|
|
5266
6175
|
ButtonKit: () => ButtonKit,
|
|
5267
6176
|
CacheProvider: () => CacheProvider,
|
|
6177
|
+
ChannelSelectMenu: () => ChannelSelectMenu,
|
|
6178
|
+
ChannelSelectMenuKit: () => ChannelSelectMenuKit,
|
|
5268
6179
|
CommandExecutionMode: () => CommandExecutionMode,
|
|
5269
6180
|
CommandKit: () => CommandKit,
|
|
5270
6181
|
CommandKitEnvironment: () => CommandKitEnvironment,
|
|
@@ -5283,15 +6194,24 @@ __export(index_exports, {
|
|
|
5283
6194
|
Localization: () => Localization,
|
|
5284
6195
|
Logger: () => Logger,
|
|
5285
6196
|
MemoryCache: () => MemoryCache,
|
|
6197
|
+
MentionableSelectMenu: () => MentionableSelectMenu,
|
|
6198
|
+
MentionableSelectMenuKit: () => MentionableSelectMenuKit,
|
|
5286
6199
|
MessageCommandOptions: () => MessageCommandOptions,
|
|
5287
6200
|
MessageCommandParser: () => MessageCommandParser,
|
|
5288
6201
|
MiddlewareContext: () => MiddlewareContext,
|
|
5289
6202
|
Modal: () => Modal,
|
|
5290
6203
|
ModalKit: () => ModalKit,
|
|
5291
6204
|
ParagraphInput: () => ParagraphInput,
|
|
6205
|
+
RoleSelectMenu: () => RoleSelectMenu,
|
|
6206
|
+
RoleSelectMenuKit: () => RoleSelectMenuKit,
|
|
5292
6207
|
RuntimePlugin: () => RuntimePlugin,
|
|
5293
6208
|
ShortInput: () => ShortInput,
|
|
6209
|
+
StringSelectMenu: () => StringSelectMenu,
|
|
6210
|
+
StringSelectMenuKit: () => StringSelectMenuKit,
|
|
6211
|
+
StringSelectMenuOption: () => StringSelectMenuOption,
|
|
5294
6212
|
TextInput: () => TextInput,
|
|
6213
|
+
UserSelectMenu: () => UserSelectMenu,
|
|
6214
|
+
UserSelectMenuKit: () => UserSelectMenuKit,
|
|
5295
6215
|
afterCommand: () => afterCommand,
|
|
5296
6216
|
bootstrapCommandkitCLI: () => bootstrapCommandkitCLI,
|
|
5297
6217
|
cache: () => cache,
|
|
@@ -5355,9 +6275,9 @@ init_signals();
|
|
|
5355
6275
|
|
|
5356
6276
|
// src/app/commands/helpers.ts
|
|
5357
6277
|
init_cjs_shims();
|
|
5358
|
-
var
|
|
6278
|
+
var import_discord20 = require("discord.js");
|
|
5359
6279
|
function isMessageSource(source) {
|
|
5360
|
-
return source instanceof
|
|
6280
|
+
return source instanceof import_discord20.Message;
|
|
5361
6281
|
}
|
|
5362
6282
|
__name(isMessageSource, "isMessageSource");
|
|
5363
6283
|
function isInteractionSource(source) {
|
|
@@ -5446,6 +6366,8 @@ var index_default = CommandKit;
|
|
|
5446
6366
|
Button,
|
|
5447
6367
|
ButtonKit,
|
|
5448
6368
|
CacheProvider,
|
|
6369
|
+
ChannelSelectMenu,
|
|
6370
|
+
ChannelSelectMenuKit,
|
|
5449
6371
|
CommandExecutionMode,
|
|
5450
6372
|
CommandKit,
|
|
5451
6373
|
CommandKitEnvironment,
|
|
@@ -5464,15 +6386,24 @@ var index_default = CommandKit;
|
|
|
5464
6386
|
Localization,
|
|
5465
6387
|
Logger,
|
|
5466
6388
|
MemoryCache,
|
|
6389
|
+
MentionableSelectMenu,
|
|
6390
|
+
MentionableSelectMenuKit,
|
|
5467
6391
|
MessageCommandOptions,
|
|
5468
6392
|
MessageCommandParser,
|
|
5469
6393
|
MiddlewareContext,
|
|
5470
6394
|
Modal,
|
|
5471
6395
|
ModalKit,
|
|
5472
6396
|
ParagraphInput,
|
|
6397
|
+
RoleSelectMenu,
|
|
6398
|
+
RoleSelectMenuKit,
|
|
5473
6399
|
RuntimePlugin,
|
|
5474
6400
|
ShortInput,
|
|
6401
|
+
StringSelectMenu,
|
|
6402
|
+
StringSelectMenuKit,
|
|
6403
|
+
StringSelectMenuOption,
|
|
5475
6404
|
TextInput,
|
|
6405
|
+
UserSelectMenu,
|
|
6406
|
+
UserSelectMenuKit,
|
|
5476
6407
|
afterCommand,
|
|
5477
6408
|
bootstrapCommandkitCLI,
|
|
5478
6409
|
cache,
|