Skip to content

Commit

Permalink
Version 2.4.1 (small bug fix update)
Browse files Browse the repository at this point in the history
Fixed time to account for your timezone. Fixed bug that would occur when the bot tried to write a new friend to the lastcomment.json after accepting the friend request after being offline.
  • Loading branch information
3urobeat committed Feb 24, 2020
1 parent a8454a3 commit 67cefad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports.run = async (logOnOptions, loginindex) => {
logger(`[${thisbot}] Added user while I was offline! User: ` + Object.keys(bot.myFriends)[i])
bot.chatMessage(Object.keys(bot.myFriends)[i], 'Hello there! Thanks for adding me!\nRequest a free comment with !comment\nType !help for more info!')

lastcomment[new SteamID(steamID.getSteam3RenderedID()).getSteamID64()] = { //add user to lastcomment file in order to also unfriend him when he never used !comment
lastcomment[new SteamID(Object.keys(bot.myFriends)[i].getSteam3RenderedID()).getSteamID64()] = { //add user to lastcomment file in order to also unfriend him when he never used !comment
time: Date.now() - (config.commentcooldown * 60000), //subtract unfriendtime to enable comment usage immediately
bot: loginindex }
fs.writeFile("./lastcomment.json", JSON.stringify(lastcomment, null, 4), err => {
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.4",
"version": "2.4.1",

"mode": 2,
"status": 1,
Expand Down
2 changes: 1 addition & 1 deletion start.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ lastcomment = require("./lastcomment.json")
/* ------------ Functions: ------------ */
var logger = function logger(str, nodate) { //Custom logger
if (nodate === true) { var string = str; } else {
var string = `\x1b[96m[${d().toISOString().replace(/T/, ' ').replace(/\..+/, '')}]\x1b[0m ${str}` }
var string = `\x1b[96m[${(new Date(Date.now() - ((d()).getTimezoneOffset() * 60000))).toISOString().replace(/T/, ' ').replace(/\..+/, '')}]\x1b[0m ${str}` }
console.log(string)
fs.appendFileSync('./output.txt', string.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '') + '\n', err => { //Credit: https://github.com/Filirom1/stripcolorcodes
if(err) logger('logger function appendFileSync error: ' + err) }) }
Expand Down

0 comments on commit 67cefad

Please sign in to comment.