question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Use .fetch() instead of .resolve() for simple command args

See original GitHub issue

Feature?

When using a simple command arg for a channel or user, the library internally uses .resolve() which will attempt to pull the target from the client’s cache. This means if the target is not cached, null will be returned.

Unfortunately moving to use .fetch() would require async and some error handling logic. The other option would be to explicitly document the behaviour and ensure that where appropriate users handle the null case.

Package

discordx

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
samarmeenacommented, Feb 17, 2022

@oceanroleplay yeah, was looking to port an old codebase using Discord.js v12 to something more modern and ran into this issue pretty quickly.

sure thanks for reporting, This issue will be resolved very soon.

0reactions
lolPantscommented, Feb 18, 2022

Was a little busy today so didn’t get around to a review, but all looks good!

Thanks for working on this 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

fetch() - Web APIs | MDN
A fetch() promise only rejects when a network error is encountered (which is usually when there's a permissions issue or similar). A fetch()...
Read more >
Introduction to fetch() - web.dev
fetch() allows you to make network requests similar to XMLHttpRequest (XHR). The main difference is that the Fetch API uses Promises, ...
Read more >
Fetch - The Modern JavaScript Tutorial
JavaScript can send network requests to the server and load new information whenever it's needed. For example, we can use a network request...
Read more >
JavaScript | fetch() Method - GeeksforGeeks
The fetch() method in JavaScript is used to request data from a server. The request can be of any type of API that...
Read more >
Consuming REST APIs In React With Fetch And Axios
Instead, it will resolve the request normally, if the response status code is a 400 or 500 type ... Basic Syntax for Using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found