Please use this instead: SquadStatJS PRO
SquadStatJS is a Discord bot that shows the SQUAD players statistics using the database that SquadJS is producing.
You can use this to entertain the players in your community. It will simulate the players in your server to play better and longer.
- MySQL sql_mode should NOT have the following mode:
ONLY-FULL-GROUP-BY
- Git
- Node.js (Current) - Download
- SquadJS
- Clone the repository:
git clone https://github.com/11TStudio/SquadStatJS
- Configure the
.env.example
file. And when done SAVE and delete the .example. (At the end the file should look like:.env
) - Run
npm install
via the terminal. - Start your bot:
node bot.js&
. (I recommend you to use pm2) - Star this repo if you liked!
SquadStatJS can be configured via .env file which by default is called .env.example.
The config file needs to be called .env at the end and a example can be found below:
# Main Settings
prefix="!"
searchTag="search"
game="squad"
# Connection Settings
serverIP="127.0.0.1"
DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN"
steamtoken="YOUR_STEAM_TOKEN"
# BM is not used yet
# battleMetricsToken="BATTLE_METRICS_TOKEN"
# Restrict the usage of the bot on a specific channel/room
channelRestricted=true
statChannel="IF_ABOFE_TRUE_FILL_IN_CHANNELID"
# Embed settings false = do not delete / true = delete | timeout is in milliseconds
deletePlayerStatsEmbed=true
deletePlayerStatsEmbedTimeout="29000"
showActiveServerEmbed=true
deleteActiveServerEmbed=true
deleteActiveServerEmbedTimeout="29000"
deleteClanStatsEmbed=true
deleteClanStatsEmbedTimeout="29000"
# User's Send Message Settings
deleteUsersCommandOnError=true
deleteUsersCommandOnSuccess=true
deleteUsersCommandOnNotFound=true
deleteUsersCommandOnTooFast=true
deleteUsersCommandOnWrongChannel=true
# Show Commands on Help embed
showOnHelpSearchCommand=true
showOnHelpSearchClanCommand=true
showOnHelpHelpCommand=false
showOnHelpCreditsCommand=false
showOnHelpUptimeCommand=false
# SquadJS Database Settings
host="127.0.0.1"
user="squadjs"
password="Your_Password"
database="squadjs"
# Write your serverID's all separated by ,(comma) like in the example below and the last one should not have any comma.
serverID="1,2,3"
ignoredMaps="'Jensen\'s Range'"
# Visual Settings
footerImg="https://cdn.discordapp.com/icons/676475499538808842/a_b40c3b2dc58d06d3d1a5d34510205cd4.gif"
author="©️ Anatolia Squad Community"
# Analytics For Developer - Sends the developer a message that you run the bot
# Code is open to read if you feel unsafe check the code :P
# No IP/password/credentials/token/etc track!
disableAnalyticsTrack=false
prefix
- The symbol/letter that your bot will use, default is!
.searchTag
- Changes the tag name that the bots responds for searching stats of the playerssearchClanTag
- Changes the tag name that the bots responds for searching for specific clan stats of the players.Usage example
-!sclan [8mm] TOP10
game
- For now it is useless. Just don't touch it.serverIP
- The public IP of your Squad Game Server.DISCORD_BOT_TOKEN
- Obvius your bot token. You can find out how to get it here: How to make a bot and get token.steamtoken
- Your Steam Token, it will be used for the activity of the player (which server is he rightnow etc...) You can find it here: SteamTokenAPI. (For domain name you need to fill the IP address of your machine that is hosting the bot)battleMetricsToken
- It is not usefull for now. Don't touch it.channelRestricted
- You can choose betweentrue
andfalse
.false
: Players can use the commands everywehere in the servr.true
: Will check the channelID (seestatChannel
) and respond only for that room. It will promt an error if you use it elsewhere.statChannel
- The room/channelID that players can use the bot (only works ifchannelRestricted=true
).deletePlayerStatsEmbed
- Toggles the delete function of the bot on/off for the Player Stats Embed (true
: on |false
: off)deletePlayerStatsEmbedTimeout
- The delete time in milliseconds for the Player Stats Embed! Default:29000
= 29secondsdeleteClanStatsEmbed
- Toggles the delete function of the bot on/off for the Clan Stats Embed (true
: on |false
: off)deleteClanStatsEmbedTimeout
- The delete time in milliseconds for the Clan Stats Embed! Default:29000
= 29secondsshowOnHelpSearchCommand
- Will show or hide thesearch player stats
command from the HELP command.showOnHelpSearchClanCommand
- Will show or hide thesearch TOP clan player stats
command from the HELP command.showOnHelpHelpCommand
- Will show or hide thehelp
command from the HELP command.showOnHelpCreditsCommand
- Will show or hide thecredits
command from the HELP command.showOnHelpUptimeCommand
- Will show or hide theuptime
command from the HELP command.showActiveServerEmbed
- Toggles the steam embed status message for players. (true
: embed message is showing active server player is playing |false
: does not show the active playing server embed) If this isfalse
thandeleteActiveServerEmbed
anddeleteActiveServerEmbedTimeout
will be irrelevant.deleteActiveServerEmbed
- Toggles the delete function of the bot on/off for the active playing @ server embed (true
: on |false
: off)deleteActiveServerEmbedTimeout
- The delete time in milliseconds for the Active Server Embed! Default:29000
= 29secondsdeleteUsersCommandOnError
-true
(default) -false
is vice-versa oftrue
true
This will delete the user's message if:Syntax is wrong
,Database connection error
deleteUsersCommandOnSuccess
-true
(default) -false
is vice-versa oftrue
true
This will delete the user's message if:User EXIST and is SUCCESFULLY SHOWN
,Clans TOP list EXIST and is SUCCESFULLY SHOWN
deleteUsersCommandOnNotFound
-true
(default) -false
is vice-versa oftrue
true
This will delete the user's message if:User not Found On DB
deleteUsersCommandOnTooFast
-true
(default) -false
is vice-versa oftrue
true
This will delete the user's message if:User writes a command too fast / that is in cooldown
deleteUsersCommandOnWrongChannel
-true
(default) -false
is vice-versa oftrue
true
This will delete the user's message if:User writes a command on wrong channel
host
- The database IP that SquadJS is using.user
- The username for that DB.password
- The password for that DB.database
- The database name for SquadJS.serverID
- The server ID that you would want to filter (most of the time it should be just "1" if you have multiple servers than you can write "1,2,etc..").ignoredMaps
- Put here the MAP names that you want to IGNORE in the stats. Default: "'Jensen's Range'"footerImg
- The little logo/image on the footer of each embed.author
- The text next tofooterImg
disableAnalyticsTrack
-false
(default) - Analytics For Developer - Sends the developer a message that you run the bot. Code is open to read if you feel unsafe check the code :P - No IP/password/credentials/token/etc track!
The following is a list of commands built into SquadJS, you can click their title for more information:
search
The search
command will automatically check if the player is saved in your DB and if so it will show his statistics.
sclan
The sclan
command usage is as following:
!sclan '[TAG-OF-CLAN]' TOP3-TOP5-TOP10
OR
!sclan "[TAG-OF-CLAN]" TOP3-TOP5-TOP10
help
The help
command will automatically grab all available commands and show them.
To create your own command you need a basic knowledge of NodeJS and DiscordJS.
I made a comms/command.js.example
ready to be edited. Just delete the .example
from it and you will be ready to go.
More about DiscordJS
Some of the information SquadJS collects from Squad servers was never intended or designed to be collected. Therefor it could be that the information the bot is showing is not 100% correct, because SquadJS issues/errors/miscalculation.
TODO...
SquadStatJS would not be possible without:
- SquadJS the main reason this bot exist.
- Anatolia Squad Community For helping me test the bot.
Boost Software License - Version 1.0 - August 17th, 2003
Copyright (c) 2020 LeventHAN-11TStudio
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.