@stelliajs/framework 1.1.0-dev-1 → 1.1.0-dev-2

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.
@@ -44,7 +44,10 @@ export class StelliaUtils {
44
44
  handleAutoCompleteInteraction = async (interaction) => {
45
45
  try {
46
46
  const interactionAutoComplete = interaction;
47
- const autoComplete = this.client.managers.autoCompletes?.getByCustomId(interactionAutoComplete.commandName);
47
+ const autoCompleteManager = this.client.managers.autoCompletes;
48
+ if (!autoCompleteManager)
49
+ return;
50
+ const autoComplete = autoCompleteManager.getByCustomId(interactionAutoComplete.commandName);
48
51
  if (!autoComplete)
49
52
  return;
50
53
  await autoComplete.execute(this.client, interactionAutoComplete);
@@ -56,7 +59,10 @@ export class StelliaUtils {
56
59
  handleButtonInteraction = async (interaction) => {
57
60
  try {
58
61
  const buttonInteraction = interaction;
59
- const button = this.client.managers.buttons?.getByCustomId(buttonInteraction.customId);
62
+ const buttonManager = this.client.managers.buttons;
63
+ if (!buttonManager)
64
+ return;
65
+ const button = buttonManager.getByCustomId(buttonInteraction.customId) || buttonManager.getByRegex(buttonInteraction.customId);
60
66
  if (!button)
61
67
  return;
62
68
  await button.execute(this.client, buttonInteraction);
@@ -68,7 +74,10 @@ export class StelliaUtils {
68
74
  handleCommandInteraction = async (interaction) => {
69
75
  try {
70
76
  const interactionCommand = interaction;
71
- const command = this.client.managers.commands?.getByCustomId(interactionCommand.commandName);
77
+ const commandManager = this.client.managers.commands;
78
+ if (!commandManager)
79
+ return;
80
+ const command = commandManager.getByCustomId(interactionCommand.commandName);
72
81
  if (!command)
73
82
  return;
74
83
  await command.execute(this.client, interactionCommand);
@@ -96,7 +105,10 @@ export class StelliaUtils {
96
105
  handleModalInteraction = async (interaction) => {
97
106
  try {
98
107
  const interactionModal = interaction;
99
- const modal = this.client.managers.modals?.getByCustomId(interactionModal.customId);
108
+ const modalManager = this.client.managers.modals;
109
+ if (!modalManager)
110
+ return;
111
+ const modal = modalManager.getByCustomId(interactionModal.customId) || modalManager.getByRegex(interactionModal.customId);
100
112
  if (!modal)
101
113
  return;
102
114
  await modal.execute(this.client, interactionModal);
@@ -108,7 +120,10 @@ export class StelliaUtils {
108
120
  handleSelectMenuInteraction = async (interaction) => {
109
121
  try {
110
122
  const interactionSelectMenu = interaction;
111
- const selectMenu = this.client.managers.selectMenus?.getByCustomId(interactionSelectMenu.customId);
123
+ const selectMenuManager = this.client.managers.selectMenus;
124
+ if (!selectMenuManager)
125
+ return;
126
+ const selectMenu = selectMenuManager.getByCustomId(interactionSelectMenu.customId) || selectMenuManager.getByRegex(interactionSelectMenu.customId);
112
127
  if (!selectMenu)
113
128
  return;
114
129
  await selectMenu.execute(this.client, interactionSelectMenu);
@@ -119,7 +134,10 @@ export class StelliaUtils {
119
134
  };
120
135
  handleMessageContextMenuInteraction = async (interaction) => {
121
136
  try {
122
- const messageContextMenu = this.client.managers.contextMenus?.getByCustomId(interaction.commandName);
137
+ const contextMenuManager = this.client.managers.contextMenus;
138
+ if (!contextMenuManager)
139
+ return;
140
+ const messageContextMenu = contextMenuManager.getByCustomId(interaction.commandName);
123
141
  if (!messageContextMenu)
124
142
  return;
125
143
  await messageContextMenu.execute(this.client, interaction);
@@ -130,7 +148,10 @@ export class StelliaUtils {
130
148
  };
131
149
  handleUserContextMenuInteraction = async (interaction) => {
132
150
  try {
133
- const userContextMenu = this.client.managers.contextMenus?.getByCustomId(interaction.commandName);
151
+ const contextMenuManager = this.client.managers.contextMenus;
152
+ if (!contextMenuManager)
153
+ return;
154
+ const userContextMenu = contextMenuManager.getByCustomId(interaction.commandName);
134
155
  if (!userContextMenu)
135
156
  return;
136
157
  await userContextMenu.execute(this.client, interaction);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stelliajs/framework",
3
- "version": "1.1.0-dev-1",
3
+ "version": "1.1.0-dev-2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {