Skip to content

Commit

Permalink
Version 2.10.7 (read commit description)
Browse files Browse the repository at this point in the history
Fixed !help command not working by shortening it. Added !commands alias to !help command. Improved instructions on how to provide login informations. Now shipping accounts.txt file by default. Added comment to accounts.txt file. Added logging message that logs the OS on startup.
  • Loading branch information
3urobeat committed Jun 13, 2021
1 parent aca151a commit ba9bc71
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 40 deletions.
1 change: 1 addition & 0 deletions accounts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//Comment: This file is an alternative for providing login informations in the form of username:password. Read instructions here: https://github.com/HerrEurobeat/steam-comment-service-bot#accounts
55 changes: 19 additions & 36 deletions src/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ module.exports.run = async (logOnOptions, loginindex) => {
var failedcomments = []
var activecommentprocess = []

var abortunfriendall;
var abortleaveallgroups;

if (loginindex == 0) var thisbot = "Main"
else var thisbot = `Bot ${loginindex}`

Expand Down Expand Up @@ -504,50 +507,30 @@ module.exports.run = async (logOnOptions, loginindex) => {

switch(cont[0].toLowerCase()) {
case '!h':
case 'help':
case '!help':
case '!commands':
if (ownercheck) {
if (Object.keys(controller.communityobject).length > 1 || config.maxOwnerComments) var commenttext = `'!comment (amount/"all") [profileid] [custom, quotes]' - Request x many or the max amount of comments (max ${config.maxOwnerComments}). Provide a profileid to comment on a specific profile.`
else var commenttext = `'!comment ("1") [profileid] [custom, quotes]' - Request 1 comment (max amount with current settings). Provide a profile id to comment on a specific profile.`
} else {
if (Object.keys(controller.communityobject).length > 1 || config.maxComments) var commenttext = `'!comment (amount/"all")' - Request x many or the max amount of comments (max ${config.maxComments}).`
else var commenttext = `'!comment' - Request a comment on your profile!`
}

/* eslint-disable no-irregular-whitespace */
if (ownercheck) { //idk if this is a good practice to define owner only commands in the same steam message but there are probably worse examples out there
var resetcooldowntext = `\n'!resetcooldown [profileid/"global"]' - Clear your, the profileid's or the global comment cooldown. Alias: !rc`;
var addfriendtext = `\n'!addfriend (profileid)'                          - Add friend with all bot accounts.`;
var unfriendtext = `\n'!unfriend (profileid)'                            - Unfriend the user from all bot accounts.`;
var unfriendalltext = `\n'!unfriendall ["abort"]'                          - Unfriends everyone with all bot accounts.`
var leavegrouptext = `\n'!leavegroup (groupid64/group url)' - Leave this group with all bot accounts.`;
var leaveallgroupstext = `\n'!leaveallgroups ["abort"]'                   - Leaves all groups with all bot accounts.`
var blocktext = `\n'!block (profileid)'                                  - Blocks the user on Steam.`
var unblocktext = `\n'!unblock (profileid)'                             - Unblocks the user on Steam. Note: The user still seems to be ignored for a few days by Steam.`
var evaltext = `\n'!eval (javascript code)'                       - Run javascript code from the steam chat.`;
var restarttext = `\n'!restart'                                                  - Restart the bot.`;
var stoptext = `\n'!stop'                                                      - Stops the bot.`;
var settingstext = `\n'!settings' (config key) (new value)  - Change a config value.`;
var logtext = `\n'!log'                                                        - Shows the last 25 lines of the log.`;
var updatetext = `\n'!update [true]'                                      - Check for an available update. 'true' forces an update.`;
if (Object.keys(controller.communityobject).length > 1 || config.maxOwnerComments) var commenttext = `'!comment (amount/"all") [profileid] [custom, quotes]' - ${lang.helpcommentowner1.replace("maxOwnerComments", config.maxOwnerComments)}`
else var commenttext = `'!comment ("1") [profileid] [custom, quotes]' - ${lang.helpcommentowner2}`
} else {
var resetcooldowntext = addfriendtext = unfriendtext = unfriendalltext = leavegrouptext = leaveallgroupstext = blocktext = unblocktext = evaltext = restarttext = stoptext = settingstext = logtext = updatetext = ""; //I'm really not proud of this line of "code"
if (Object.keys(controller.communityobject).length > 1 || config.maxComments) var commenttext = `'!comment (amount/"all")' - ${lang.helpcommentuser1.replace("maxComments", config.maxComments)}`
else var commenttext = `'!comment' - ${lang.helpcommentuser2}`
}

if (config.yourgroup.length > 1) var yourgrouptext = "\nJoin my '!group'!";
if (config.yourgroup.length > 1) var yourgrouptext = lang.helpjoingroup;
else var yourgrouptext = "";

chatmsg(steamID, `
() <-- needed argument\n[] <-- optional argument\n\nCommand list:\n

chatmsg(steamID, `${extdata.mestr}'s Comment Bot | ${lang.helpcommandlist}\n
${commenttext}\n
'!ping'                                                       - Get a pong and heartbeat in ms.
'!info'                                                        - Get useful information about the bot and you.
'!abort'                                                     - Abort your own comment process.${resetcooldowntext}${settingstext}${addfriendtext}${unfriendtext}${unfriendalltext}${leavegrouptext}${leaveallgroupstext}${blocktext}${unblocktext}
'!failed'                                                     - See the exact errors of your last comment request.
'!about'                                                    - Returns information what this is about.
'!owner'                                                   - Get a link to the profile of the operator of this bot instance.${evaltext}${restarttext}${stoptext}${logtext}${updatetext}
'!ping' - ${lang.helpping}
'!info' - ${lang.helpinfo}
'!abort' - ${lang.helpabort}
'!about' - ${lang.helpabout}
'!owner' - ${lang.helpowner}
${yourgrouptext}
`)
/* eslint-enable no-irregular-whitespace */
${lang.helpreadothercmdshere} ' https://github.com/HerrEurobeat/steam-comment-service-bot/wiki/Commands-documentation '`)
break;

case '!comment':
Expand Down
2 changes: 2 additions & 0 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ try {
if (fs.existsSync("./accounts.txt")) {
var data = fs.readFileSync("./accounts.txt", "utf8").split("\n")

if (data[0].startsWith("//Comment")) data = data.slice(1); //Remove comment from array

if (data != "") {
logger("Accounts.txt does exist and is not empty - using it instead of logininfo.json.", false, true)

Expand Down
6 changes: 3 additions & 3 deletions src/data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "2106",
"versionstr": "2.10.6",
"version": "2107",
"versionstr": "2.10.7",
"branch": "master",
"filetostart": "./src/updater.js",
"filetostarturl": "https://raw.githubusercontent.com/HerrEurobeat/steam-comment-service-bot/master/src/updater.js",
Expand All @@ -9,7 +9,7 @@
"aboutstr": "This bot was created by 3urobeat.\nGitHub: https://github.com/HerrEurobeat/steam-comment-service-bot \nSteam: https://steamcommunity.com/id/3urobeat \nIf you like my work, any donation would be appreciated! https://paypal.me/3urobeat",
"firststart": true,
"compatibilityfeaturedone": false,
"whatsnew": "Fixed restart function not correctly unloading old session leading to crashes. Fixed bot not relogging after connection loss that wasn't NoConnection. Improved some responses/logs and delays. Other changes listed on GitHub.",
"whatsnew": "Fixed !help command not working by shortening it. Added !commands alias to !help command. Improved instructions on how to provide login informations. Now shipping accounts.txt file by default. Added comment to accounts.txt file.",
"urlrequestsecretkey": "",
"timesloggedin": 0,
"totallogintime": 0
Expand Down
15 changes: 14 additions & 1 deletion src/defaultlang.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"commentinvalidprofileid": "This is not a valid profileid! A profile id must look like this: 76561198260031749\nCommand usage: commentcmdusage",
"commentprofileidowneronly": "Specifying a profileid is only allowed for bot owners.\nIf you are a bot owner, make sure you added your ownerid to the config.json.",
"commentmissingnumberofcomments": "Please specify how many comments out of maxrequestamount you would like to request.\nCommand usage: commentcmdusage",
"commentaddbotaccounts": "In order to request numberofcomments comments you/the recieving user will first need to add this/these accounts: (limited bot accounts)",
"commentaddbotaccounts": "In order to request numberofcomments comments you/the recieving user will need to add these accounts and then request comments again: (limited bot accounts)",
"commentuserprofileprivate": "Your/the recieving profile seems to be private. Please edit your/the privacy settings on your/the recieving profile and try again!",
"commenterroroccurred": "Oops, an error occurred!",
"commentsuccess1": "Okay I commented on your/the recieving profile! If you are a nice person then please comment on my profile too!",
Expand All @@ -34,6 +34,19 @@
"commandowneronly": "This command is only available for the botowner.\nIf you are the botowner, make sure you added your ownerid to the config.json.",
"invalidprofileid": "This is not a valid profileid! A profile id must look like this: 76561198260031749",

"helpcommandlist": "Command list:",
"helpcommentowner1": "Request x many or the max amount of comments (max maxOwnerComments). Provide a profileid to comment on a specific profile.",
"helpcommentowner2": "Request 1 comment (max amount with current settings). Provide a profile id to comment on a specific profile.",
"helpcommentuser1": "Request x many or the max amount of comments (max maxComments).",
"helpcommentuser2": "Request a comment on your profile!",
"helpping": "Get a pong and response time from Steam in ms.",
"helpinfo": "Get useful information about the bot and you.",
"helpabort": "Abort your own requested comment process.",
"helpabout": "Returns information about this bot, including a link to GitHub.",
"helpowner": "Get a link to the profile of the operator/host of this bot instance.",
"helpjoingroup": "Join my '!group'!",
"helpreadothercmdshere": "To keep this message short please read all other commands here:",

"pingcmdmessage": "Pong! 🏓\nTime to steamcommunity.com/ping response: pingtimems",
"ownercmdnolink": "The operator of this bot didn't include a link to him/herself.)",
"ownercmdmsg": "Check out my owner's profile: (for more information about the bot type !about)",
Expand Down
1 change: 1 addition & 0 deletions src/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ var checkforupdate = (forceupdate, responseSteamID, compatibilityfeaturedone) =>

logger("\nBootup sequence started...", true, true) //mark new execution in output.txt
logger(`Using node.js version ${process.version}...`, false, true)
logger(`Running on ${process.platform}...`, false, true)

/* ------------ File integrity checks: ------------ */
//Check cache.json
Expand Down

0 comments on commit ba9bc71

Please sign in to comment.