Skip to content

Commit

Permalink
::modify:: => anyone can click on btn
Browse files Browse the repository at this point in the history
  • Loading branch information
spuckhafte committed Jul 12, 2023
1 parent 9766158 commit 8a00e17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/helpers/funcs.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Message } from "discord.js";
export declare function err(desc: string, cmd?: string, warn?: boolean): string;
/**Listen to button interactions
* @param users - array of user-ids who can click on button
* @param users - array of user-ids who can click on button, empty array => anyone can click
* @param msg - the msg sent containing the buttons
* @param props - (?) listen to a specific button of an id only, define the max valid interactions and/or define the time(ms) interval for which the clicks will be valid
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/helpers/funcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function err(desc, cmd, warn = false) {
return `[${warn ? 'warn' : 'err'}][cmd: ${cmd}] ${desc}`;
}
/**Listen to button interactions
* @param users - array of user-ids who can click on button
* @param users - array of user-ids who can click on button, empty array => anyone can click
* @param msg - the msg sent containing the buttons
* @param props - (?) listen to a specific button of an id only, define the max valid interactions and/or define the time(ms) interval for which the clicks will be valid
*/
Expand All @@ -11,7 +11,7 @@ export function buttonSignal(users, msg, props) {
return;
const collector = msg.channel.createMessageComponentCollector({
filter: btn => {
return users.includes(btn.user.id)
return (users.length == 0 || users.includes(btn.user.id))
&& msg.id == btn.message.id
&& ((props === null || props === void 0 ? void 0 : props.customId) ? props.customId == btn.customId : true);
},
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function err(desc:string, cmd?:string, warn=false) {
}

/**Listen to button interactions
* @param users - array of user-ids who can click on button
* @param users - array of user-ids who can click on button, empty array => anyone can click
* @param msg - the msg sent containing the buttons
* @param props - (?) listen to a specific button of an id only, define the max valid interactions and/or define the time(ms) interval for which the clicks will be valid
*/
Expand All @@ -18,7 +18,7 @@ export function buttonSignal(
const collector = msg.channel.createMessageComponentCollector(
{
filter: btn => {
return users.includes(btn.user.id)
return (users.length == 0 || users.includes(btn.user.id))
&& msg.id == btn.message.id
&& (props?.customId ? props.customId == btn.customId : true);
},
Expand Down

0 comments on commit 8a00e17

Please sign in to comment.