Skip to content

Commit

Permalink
chore: Fix missing filterAccounts() return doc and add 'all' filter
Browse files Browse the repository at this point in the history
  • Loading branch information
3urobeat committed Jan 2, 2025
1 parent 760dae1 commit 058573d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/controller/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2021-07-09 16:26:00
* Author: 3urobeat
*
* Last Modified: 2025-01-02 10:38:34
* Last Modified: 2025-01-02 12:35:45
* Modified By: 3urobeat
*
* Copyright (c) 2021 - 2025 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -458,6 +458,7 @@ Controller.prototype.respreadProxies = async function() {};
/**
* Filters the active set of bot accounts by a given criteria
* @param {function(Bot): boolean} predicate Function that returns true if the account should be included in the result
* @returns {Array.<Bot>} Array of bot instances that match the criteria
*/
Controller.prototype.filterAccounts = function(predicate) {}; // eslint-disable-line

Expand Down
4 changes: 3 additions & 1 deletion src/controller/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2024-12-28 12:56:44
* Author: 3urobeat
*
* Last Modified: 2025-01-01 23:06:52
* Last Modified: 2025-01-02 12:35:51
* Modified By: 3urobeat
*
* Copyright (c) 2024 - 2025 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -186,6 +186,7 @@ Controller.prototype.respreadProxies = async function() {
/**
* Filters the active set of bot accounts by a given criteria
* @param {function(Bot): boolean} predicate Function that returns true if the account should be included in the result
* @returns {Array.<Bot>} Array of bot instances that match the criteria
*/
Controller.prototype.filterAccounts = function(predicate) { // TODO: Adapt getBots() function to use this function
return this.getBots("*").filter(predicate);
Expand All @@ -196,6 +197,7 @@ Controller.prototype.filterAccounts = function(predicate) { // TODO: Adapt getBo
* @type {{ statusOnline: Function, limited: Function }}
*/
Controller.prototype.filters = {
all: (bot) => bot != null,
statusOffline: (bot) => bot.status == EStatus.OFFLINE,
statusOnline: (bot) => bot.status == EStatus.ONLINE,
statusError: (bot) => bot.status == EStatus.ERROR,
Expand Down
6 changes: 3 additions & 3 deletions src/data/fileStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
{
"path": "src/controller/controller.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/controller.js",
"checksum": "45b943499daa41b8e24e2c22b900a0ae"
"checksum": "138389c2567ce31a9c6ee0814019df79"
},
{
"path": "src/controller/events/ready.js",
Expand Down Expand Up @@ -328,7 +328,7 @@
{
"path": "src/controller/manage.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/manage.js",
"checksum": "b90c58f8572de34a9bae87cf2b912e7c"
"checksum": "4d3638ef246dcbe4f550e658c4c2ad87"
},
{
"path": "src/data/ascii.js",
Expand Down Expand Up @@ -628,7 +628,7 @@
{
"path": "types/types.d.ts",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/types/types.d.ts",
"checksum": "49ed21df68d538456746c027ac95663b"
"checksum": "e3d00433c08291f7a3950ee3d86c4ec0"
}
]
}
6 changes: 4 additions & 2 deletions types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,9 @@ declare class Controller {
/**
* Filters the active set of bot accounts by a given criteria
* @param predicate - Function that returns true if the account should be included in the result
* @returns Array of bot instances that match the criteria
*/
filterAccounts(predicate: (...params: any[]) => any): void;
filterAccounts(predicate: (...params: any[]) => any): Bot[];
/**
* Set of premade functions for filterAccounts()
*/
Expand Down Expand Up @@ -802,8 +803,9 @@ declare class Controller {
/**
* Filters the active set of bot accounts by a given criteria
* @param predicate - Function that returns true if the account should be included in the result
* @returns Array of bot instances that match the criteria
*/
filterAccounts(predicate: (...params: any[]) => any): void;
filterAccounts(predicate: (...params: any[]) => any): Bot[];
/**
* Set of premade functions for filterAccounts()
*/
Expand Down

0 comments on commit 058573d

Please sign in to comment.