Skip to content

Create getComponents.js #731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: v6
Choose a base branch
from
Open

Create getComponents.js #731

wants to merge 2 commits into from

Conversation

YordiGamex
Copy link
Contributor

@YordiGamex YordiGamex commented Jul 14, 2025

Description

This is a function I made, it is used to read components, it helps a lot since now some bots are using v2 components, so it would be good to get ahead of that kind of things

Use: $getComponents[$channelID?;$messageID]

Type of change

Please check options that describe your Pull Request:

  • Bug fix (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

  • My code follows the style guidelines of this project
  • Any dependent changes have been merged and published in downstream modules

This is a function I made, it is used to read components, it helps a lot since now some bots are using v2 components, so it would be good to get ahead of that kind of things

Use: $getComponents[$channelID?;$messageID]
@Faf4a
Copy link
Member

Faf4a commented Jul 14, 2025

Please edit the Issue description properly, thanks

@YordiGamex
Copy link
Contributor Author

I have already modified the description

);
}

const channel = d.client.channels.cache.get(channelID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const channel = d.client.channels.cache.get(channelID);
const channel = d.util.getChannel(channelID);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

Comment on lines 20 to 27
if (!channel) {
return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
`Channel with ID "${channelID}" was not found.`
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!channel) {
return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
`Channel with ID "${channelID}" was not found.`
);
}
if (!channel) {
return d.aoiError.fnError(
d,
"channel",
{ inside: data.inside },
);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

Comment on lines 33 to 38
return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
`Failed to fetch message with ID "${messageID}".`
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
`Failed to fetch message with ID "${messageID}".`
);
return d.aoiError.fnError(
d,
"message",
{ inside: data.inside },
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ inside: data.inside },
{},

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

Comment on lines 11 to 16
return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
"You must provide the message ID."
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return d.aoiError.fnError(
d,
"custom",
{ inside: data.inside },
"You must provide the message ID."
);
return d.aoiError.fnError(
d,
"message",
{ inside: data.inside },
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

const data = d.util.aoiFunc(d);
if (data.err) return d.error(data.err);

const [channelID = d.channel?.id, messageID] = data.inside.splits;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [channelID = d.channel?.id, messageID] = data.inside.splits;
const [channelID = d.channel?.id, messageID = d.message?.id] = data.inside.splits;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

I already made the changes you mentioned above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants