diff --git a/bot2019.db/000155.ldb b/bot2019.db/000155.ldb deleted file mode 100644 index f4e240a..0000000 Binary files a/bot2019.db/000155.ldb and /dev/null differ diff --git a/bot2019.db/000157.ldb b/bot2019.db/000157.ldb deleted file mode 100644 index ba0b067..0000000 Binary files a/bot2019.db/000157.ldb and /dev/null differ diff --git a/bot2019.db/000160.ldb b/bot2019.db/000160.ldb deleted file mode 100644 index eea4981..0000000 Binary files a/bot2019.db/000160.ldb and /dev/null differ diff --git a/bot2019.db/000161.log b/bot2019.db/000161.log deleted file mode 100644 index 3fbcbd6..0000000 Binary files a/bot2019.db/000161.log and /dev/null differ diff --git a/bot2019.db/000168.ldb b/bot2019.db/000168.ldb new file mode 100644 index 0000000..63a10c1 Binary files /dev/null and b/bot2019.db/000168.ldb differ diff --git a/bot2019.db/000170.ldb b/bot2019.db/000170.ldb new file mode 100644 index 0000000..84b9f29 Binary files /dev/null and b/bot2019.db/000170.ldb differ diff --git a/bot2019.db/000171.log b/bot2019.db/000171.log new file mode 100644 index 0000000..1b92b5a Binary files /dev/null and b/bot2019.db/000171.log differ diff --git a/bot2019.db/CURRENT b/bot2019.db/CURRENT index eda0873..b0fe36e 100644 --- a/bot2019.db/CURRENT +++ b/bot2019.db/CURRENT @@ -1 +1 @@ -MANIFEST-000159 +MANIFEST-000169 diff --git a/bot2019.db/LOG b/bot2019.db/LOG index dfcbd5e..ce8db5a 100644 --- a/bot2019.db/LOG +++ b/bot2019.db/LOG @@ -1,5 +1,5 @@ -2021/05/13-20:15:39.975 cf4 Recovering log #158 -2021/05/13-20:15:40.183 cf4 Level-0 table #160: started -2021/05/13-20:15:40.220 cf4 Level-0 table #160: 276036 bytes OK -2021/05/13-20:15:40.236 cf4 Delete type=0 #158 -2021/05/13-20:15:40.239 cf4 Delete type=3 #156 +2021/08/06-00:12:04.964 2320 Recovering log #167 +2021/08/06-00:12:04.964 2320 Level-0 table #170: started +2021/08/06-00:12:04.970 2320 Level-0 table #170: 213 bytes OK +2021/08/06-00:12:04.985 2320 Delete type=0 #167 +2021/08/06-00:12:04.989 2320 Delete type=3 #165 diff --git a/bot2019.db/LOG.old b/bot2019.db/LOG.old index 1ba9172..dba851e 100644 --- a/bot2019.db/LOG.old +++ b/bot2019.db/LOG.old @@ -1,5 +1,14 @@ -2021/05/12-13:48:11.247 53ec Recovering log #154 -2021/05/12-13:48:11.247 53ec Level-0 table #157: started -2021/05/12-13:48:11.256 53ec Level-0 table #157: 228 bytes OK -2021/05/12-13:48:11.276 53ec Delete type=0 #154 -2021/05/12-13:48:11.279 53ec Delete type=3 #152 +2021/08/06-00:11:59.612 6c3c Recovering log #164 +2021/08/06-00:11:59.612 6c3c Level-0 table #166: started +2021/08/06-00:11:59.627 6c3c Level-0 table #166: 3461 bytes OK +2021/08/06-00:11:59.685 6c3c Delete type=0 #164 +2021/08/06-00:11:59.689 6c3c Delete type=3 #162 +2021/08/06-00:11:59.700 66a4 Compacting 4@0 + 1@1 files +2021/08/06-00:11:59.750 66a4 Generated table #168@0: 8 keys, 661 bytes +2021/08/06-00:11:59.750 66a4 Compacted 4@0 + 1@1 files => 661 bytes +2021/08/06-00:11:59.752 66a4 compacted to: files[ 0 1 0 0 0 0 0 ] +2021/08/06-00:11:59.752 66a4 Delete type=2 #155 +2021/08/06-00:11:59.760 66a4 Delete type=2 #157 +2021/08/06-00:11:59.763 66a4 Delete type=2 #160 +2021/08/06-00:11:59.767 66a4 Delete type=2 #163 +2021/08/06-00:11:59.771 66a4 Delete type=2 #166 diff --git a/bot2019.db/MANIFEST-000159 b/bot2019.db/MANIFEST-000159 deleted file mode 100644 index e6d95f2..0000000 Binary files a/bot2019.db/MANIFEST-000159 and /dev/null differ diff --git a/bot2019.db/MANIFEST-000169 b/bot2019.db/MANIFEST-000169 new file mode 100644 index 0000000..6938601 Binary files /dev/null and b/bot2019.db/MANIFEST-000169 differ diff --git a/src/Commands.js b/src/Commands.js index 3d95e37..c916158 100644 --- a/src/Commands.js +++ b/src/Commands.js @@ -153,7 +153,7 @@ module.exports = (bot) => { setTimeout(function() { var duration = 6 + Math.random() * 24; for(var i = 0; i < duration; i++) { - sendChat("1"); + // sendChat("1"); if(Math.random() > 0.5) { setTimeout(function() { db.getFruits(function(num_fruits) { @@ -1448,4 +1448,123 @@ module.exports = (bot) => { } }); }, false); + + bot.addCommand(['/hug'], 0, msg => { + var part = findParticipantByNameFuzzy(msg.argcat()); + if (part) { + let hug = rando("a squeeze", "an affectionate hug", + "a deep, passionate hug", `a "normal" hug`, "a snug hug", "a new hug", "a special embrace", "caring hug"); + sendChat(`Our friend ` + msg.p.name + ` gave ` + part.name + ' ' + hug); + } else { + db.getLocation(msg.p._id, location => { + var message = "Friend " + msg.p.name + " missed and the hug went everywhere."; + if (location == 'outside' && Math.random() < 0.25) { + message += " Some of it went into the water and love was felt by the fish inside."; + } + sendChat(message); + }); + } + }, false); + + bot.addCommand(['/give'], 0, msg => { + var thief = msg.p; + var victim = findParticipantByNameFuzzy(msg.args[0]); + if (!victim) { + sendChat("Friend " + thief.name + " missed"); + return; + } + if (victim._id == thief._id) { + sendChat("Friendly friend " + thief.name + " fudged"); + return; + } + var target_fish = msg.argcat(1); + db.getFish(thief._id, function (thief_fish) { + db.getFish(victim_id, function (victim_fish) { + if (victim_fish.length >= TOO_MANY_FISH) { + sendChat("Friend " + victim.name + " is carrying too much."); + return; + } + if (thief_fish.length > 0) { + var idx = -1; + var arg = target_fish.trim().toLowerCase(); + for (var i = 0; i < thief_fish.length; i++) { + if (arg == "" || thief_fish[i].toLowerCase().indexOf(arg) !== -1) { + idx = i; + break; + } + } + if (idx == -1) { + sendChat("Friend " + thief.name + ": You don't have a " + arg + "that you can /give like that."); + return; + } + var thefish = thief_fish[idx]; + thief_fish.splice(idx, 1); + victim_fish.push(thefish); + + sendChat("Our friend" + thief.name + " gave " + victim.name + " his/her " + thefish); + db.putFish(thief._id, thief_fish); + db.putFish(victim._id, victim_fish); + } else { + sendChat("Friend " + thief.name + ": You don't have the fish to give."); + } + }); + }); + return; + }, false); + + // bot.addCommand(['/give_'], 0, msg => { + + // }, true); + + bot.addCommand(['/bestow'], 0, msg => { + var thief = msg.p; + var victim = findParticipantByNameFuzzy(msg.args[0]); + if (!victim) { + sendChat("Friend " + thief.name + " missed"); + return; + } + if (victim._id == thief._id) { + sendChat("Friendly friend " + thief.name + " fudged"); + return; + } + var target_fish = msg.argcat(1); + db.getFish(thief._id, function (thief_fish) { + db.getFish(victim_id, function (victim_fish) { + if (victim_fish.length >= TOO_MANY_FISH) { + sendChat("Friend " + victim.name + " is carrying too much."); + return; + } + if (thief_fish.length > 0) { + var idx = -1; + var arg = target_fish.trim().toLowerCase(); + for (var i = 0; i < thief_fish.length; i++) { + if (arg == "" || thief_fish[i].toLowerCase().indexOf(arg) !== -1) { + idx = i; + break; + } + } + if (idx == -1) { + sendChat("Friend " + thief.name + ": You don't have " + arg + "."); + return; + } + var thefish = thief_fish[idx]; + thief_fish.splice(idx, 1); + victim_fish.push(thefish); + + sendChat("Our friend" + thief.name + " bestowed " + victim.name + " his/her " + thefish); + db.putFish(thief._id, thief_fish); + db.putFish(victim._id, victim_fish); + } else { + sendChat("Friend " + thief.name + ": You don't have the fish to bestow."); + } + }); + }); + return; + }); + + // bot.addCommand(['/bestow_'], 0, msg => { + + // }, true); + + }