A sample interaction awaiter that specifically only cares about button interactions with globally unique custom IDs.
Can be modified to respond differently to other conditions (i.e. only letting a specific user click the button, or handling other sorts of components). If that's what you want to do, you'll want to modify the
buttons data structure to hold information about your custom conditions, and add logic within the
interactionCreate listener to only call the associated resolver function when necessary.
This is a naive implementation, with several potential issues:
listeningis a global variable, not directly associated with the
clientthe listener is being added to (though you really shouldn't have multiple clients in your project anyway so it's probably fine)
- Using an object for
buttonsmeans that only one person can listen for a specific
customIDat a time; this code will just overwrite the old listener if it's called a second time with the same ID, causing the ol