-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214
- Loading branch information
Showing
111 changed files
with
6,404 additions
and
1,641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Contributing to the project | ||
|
||
You would like to contribute to the project itself? | ||
Great! No matter if it's fixing a few typos or adding a whole feature - every contribution is welcome. | ||
|
||
The contributing page is located in the project's wiki, please [click here to get redirected](./docs/wiki/contributing.md)! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"note": "Please read here on how to use this file: https://github.com/3urobeat/steam-comment-service-bot/blob/master/docs/wiki/customlang_doc.md" | ||
"english": { | ||
"note": "Please read here on how to use this file: https://github.com/3urobeat/steam-comment-service-bot/blob/master/docs/wiki/customlang_doc.md" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Welcome to the steam-comment-service-bot developer documentation! | ||
[⬅️ Go back to the main page](../..#readme) | ||
|
||
The developer documentation includes pages for every module and some useful information about it. | ||
This should help you figuring out how to implement parts of the bot into your plugin or when working on the project itself! | ||
|
||
It makes sense to first learn how this project works and is built before diving in further. The [introduction](./introduction.md) page should get you started quickly. | ||
|
||
Are you rather searching for the wiki? [Click here to get redirected](../wiki#readme) | ||
|
||
| ||
|
||
## Table of Contents | ||
This documentation uses the same structure as the `src` folder. Each top-level module listed here contains further links to its submodules. | ||
The order of this list represents the order in which they are instantiated when the application is started. | ||
|
||
- [Introduction](./introduction.md) | ||
- Parent Process: | ||
- [Starter](./starter.md) | ||
- Child Process: | ||
- [Controller](./controller/controller.md) | ||
- [DataManager](./dataManager/dataManager.md) | ||
- [Updater](./updater/updater.md) | ||
- [Bot](./bot/bot.md) | ||
- [sessionHandler](./sessionHandler/sessionHandler.md) | ||
- [CommandHandler](./commands/commandHandler.md) | ||
- [PluginSystem](./pluginSystem/pluginSystem.md) | ||
|
||
| ||
|
||
## Contact | ||
Steam profile: https://steamcommunity.com/id/3urobeat | ||
Steam group: https://steamcommunity.com/groups/3urobeatGroup | ||
Comment Bot: https://steamcommunity.com/id/3urobeatscommentbot | ||
YouTube Tutorial: https://youtu.be/8J78rC9Z28U | ||
Discord: @3urobeat | ||
|
||
| ||
|
||
> Steam Comment Service Bot - Created with ❤️ and a lot of time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Bot | ||
[⬅️ Go back to dev home](../#readme) <a href="/src/bot/bot.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
|
||
| ||
|
||
When logging in, the controller creates a bot object for every Steam account the user has provided. | ||
It creates a SteamUser and SteamCommunity instance, which allow the Controller to use this bot account to interact with Steam. | ||
The bot object itself handles events for this specific account (e.g. chat messages), informs the Controller about connection losses, etc. | ||
|
||
| ||
|
||
Every function and object property is documented with JsDocs in the implementation file. | ||
Please check them out using your IntelliSense or by clicking the button in the top right corner of this page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Bot Events | ||
[⬅️ Go back to Bot](./bot.md) <a href="/src/bot/events" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Folder-darkcyan"></a> | ||
|
||
| ||
|
||
Each bot object handles their own [SteamUser](https://github.com/DoctorMcKay/node-steam-user) events. | ||
These event handlers are located inside the bot events folder and contain each a prototype function for attaching themselves. | ||
These functions follow the naming scheme `_attachSteamEventNameEvent` and are being called by the Bot constructor. | ||
|
||
| ||
|
||
## Table of Contents | ||
- [debug](#debug--debug-verbose-) | ||
- [disconnected](#disconnected-) | ||
- [error](#error-) | ||
- [friendMessage](#friendMessage-) | ||
- [loggedOn](#loggedOn-) | ||
- [relationship](#relationship-) | ||
- [webSession](#webSession-) | ||
|
||
Please use your browser's search function <kbd>Ctrl</kbd>+<kbd>F</kbd> to find a specific event using its name on this page. | ||
|
||
| ||
|
||
## debug & debug-verbose <a href="/src/bot/events/debug.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
The content of these events is logged to the terminal when `steamUserDebug` and `steamUserDebugVerbose` are set to `true` in the `advancedconfig.json`. | ||
|
||
## disconnected <a href="/src/bot/events/disconnected.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Handles a disconnect by logging to the terminal, updating its status and trying to relog itself, unless it is an intentional log off. | ||
|
||
## error <a href="/src/bot/events/error.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Handles login errors by logging to the terminal, updating its status and either retrying the login or skipping the account. | ||
|
||
## friendMessage <a href="/src/bot/events/friendMessage.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Handles Steam Chat messages to this account. | ||
If this is the main account it will instruct the [CommandHandler](../commandHandler/commandHandler.md) to run the command or apply a cooldown if the user is spamming. | ||
If this is a child account, it will respond with a message pointing to the main account. | ||
|
||
## loggedOn <a href="/src/bot/events/loggedOn.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Logs a message, sets the online status and increments the progress bar (on initial login) when this bot account establishes a connection to Steam. | ||
|
||
## relationship <a href="/src/bot/events/relationship.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Handles an incoming friend request or group invite by adding the user to the `lastcomment.db` database and inviting them to the group set in `config.json`. | ||
|
||
## webSession <a href="/src/bot/events/webSession.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Handles setting cookies, accepting friend requests & group invites while the bot was offline, updates the bot's status, performs a few checks and starts playing games. | ||
This event is fired after loggedOn when this bot account establishes a connection to Steam. | ||
|
||
After this event was handled, a bot account is considered to be online and ready to be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# CommandHandler | ||
[⬅️ Go back to dev home](../#readme) <a href="/src/commands/commandHandler.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
|
||
| ||
|
||
The CommandHandler manages the Bot's functionality which is accessible by the user, for example through the Steam Chat. | ||
On startup, it loads a bunch of core commands shipped with the application and exposes functions to un-/register commands at runtime, for example using plugins. | ||
Lastly, the module contains a helper folder which stores various functions used by commands, like getting all available bot accounts or parsing command arguments. | ||
|
||
By default, the bot comes with one command handler which implements this module: The Bot's [friendMessage](../bot/events.md#friendmessage-) event. | ||
This adds support for running commands and receiving answers through the Steam Chat. | ||
|
||
| ||
|
||
Every function and object property is documented with JsDocs in the implementation file. | ||
Please check them out using your IntelliSense or by clicking the button in the top right corner of this page. | ||
|
||
| ||
|
||
|
||
### resInfo | ||
Object representing the default/commonly used content the resInfo object can/should contain. | ||
The resInfo object is passed to every command and contains valuable information about the command handler which executes this command (plugins implementing other chat platforms need to implement their own command handler of course), | ||
about the user who ran the command, which userIDs have owner rights, etc. | ||
The commandHandler of e.g. a plugin can add more information to this object as they please. This can be useful to pass more information to their commands, through the commandHandler. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Controller | ||
[⬅️ Go back to dev home](../#readme) <a href="/src/controller/controller.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
|
||
| ||
|
||
The Controller is the center piece of the application. | ||
It is the entry point of the child process, which gets spawned by the [parent process](../starter.md). | ||
It stores references to all the other modules, does first checks (e.g. internet connection, unsupported nodejs version) and handles the startup. | ||
|
||
The parent process forks a child that loads `controller.js` into memory and sets a timestamp of startup as `process.argv[3]`. | ||
Any data which should be passed through a restart will be set as a stringified object at `process.argv[4]`. | ||
If the mentioned timestamp is within the last 2.5 seconds, `controller.js` will create a new Controller object and call `_start()` to start the application. | ||
|
||
Most functions are prototype functions linked to the existing Controller object at runtime, some may however still be normal exported functions. | ||
Please check the [Helpers](./helpers.md) page of this module to see functions which still belong to this module but may not be listed directly on this page. | ||
|
||
| ||
|
||
Every function and object property is documented with JsDocs in the implementation file. | ||
Please check them out using your IntelliSense or by clicking the button in the top right corner of this page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Controller Events | ||
[⬅️ Go back to Controller](./controller.md) <a href="/src/controller/events" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Folder-darkcyan"></a> | ||
|
||
| ||
|
||
The events folder contains functions for events which the Controller supports. | ||
These functions are called by the Controller, which then in turn actually emit the event using the `controller.events` EventEmitter. | ||
This allows for running internal code (e.g. ready event) before an external module receives them. | ||
|
||
| ||
|
||
## Table of Contents | ||
- [ready](#ready-) | ||
- [statusUpdate](#statusUpdate-) | ||
- [steamGuardInput](#steamGuardInput-) | ||
|
||
Please use your browser's search function <kbd>Ctrl</kbd>+<kbd>F</kbd> to find a specific event using its name on this page. | ||
|
||
| ||
|
||
## ready <a href="/src/controller/events/ready.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
This event is emitted when the bot finished logging in all bot accounts for the first time since the last start/restart. | ||
|
||
Before emitting the event, the bot will | ||
- ...log the ready messages containing a variety of useful information | ||
- ...instruct the [DataManager](../dataManager/dataManager.md) to refresh the `cache.json` backups of all config files | ||
- ...log held back log messages from during the startup | ||
- ...perform various checks and display warnings if for example the friendlist space is running low | ||
- ...and update the total login time in data.json. | ||
|
||
No arguments. | ||
|
||
## statusUpdate <a href="/src/controller/events/statusUpdate.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
This event is emitted when any bot account changes their online status. | ||
|
||
Before emitting the event, the bot will update the `status` property of the affected bot account to the new status. | ||
|
||
The event is emitted with the parameters | ||
- `bot` ([Bot](../bot/bot.md)) - Bot instance of the affected account | ||
- `newStatus` (Bot.[EStatus](/src/bot/EStatus.js)) - The new status of this bot | ||
|
||
## steamGuardInput <a href="/src/controller/events/steamGuardInput.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
This event is emitted when any bot account requires a Steam Guard Code to be submitted before it can continue logging in. | ||
|
||
The event is emitted with the parameters | ||
- `bot` ([Bot](../bot/bot.md)) - Bot instance of the affected account | ||
- `submitCode` (function(string): void) - Function to submit a code. Pass an empty string to skip the account. | ||
|
||
The `submitCode` function allows users to implement accepting Steam Guard Codes from users into their plugins. This is very cool. | ||
Check out how the [template plugin](https://github.com/3urobeat/steam-comment-bot-template-plugin/blob/main/plugin.js) implements the | ||
`steamGuardInput` event function (which is called by the PluginSystem when the event is emitted, instead of listening directly to it). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Controller Helpers | ||
[⬅️ Go back to Controller](./controller.md) <a href="/src/controller/helpers" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Folder-darkcyan"></a> | ||
|
||
| ||
|
||
The helpers folder contains functions which are regularly used, often by multiple files, also from other modules. | ||
Each module has their own helpers folder, containing helper functions which fit the best to that specific module, to keep the project structure organized. | ||
|
||
All prototype functions which are directly accessible from the active Controller object at runtime are already listed in the [Controller](./controller.md) docs page. | ||
This page only includes functions which are directly exported, meaning to use them you need to import that specific helper file in your code. | ||
|
||
| ||
|
||
## Table of Contents | ||
- [misc.js](#miscjs-) | ||
- [npminteraction.js](#npminteractionjs-) | ||
|
||
| ||
|
||
## misc.js <a href="/src/controller/helpers/misc.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> | ||
Special Case: The functions in this helper are directly accessible from the Controller object to make using them easier. You can access them through the Controller `misc` object. | ||
|
||
| ||
|
||
## npminteraction.js <a href="/src/controller/helpers/npminteraction.js" target="_blank"><img align="right" src="https://img.shields.io/badge/<%2F>%20Source-darkcyan"></a> |
Oops, something went wrong.