This commit is contained in:
Hri7566 2021-05-28 17:11:30 -04:00
parent 803f0749bf
commit be50b9ad1c
14 changed files with 105 additions and 24 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bot2019.db/000155.ldb Normal file

Binary file not shown.

BIN
bot2019.db/000157.ldb Normal file

Binary file not shown.

BIN
bot2019.db/000160.ldb Normal file

Binary file not shown.

BIN
bot2019.db/000161.log Normal file

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000105
MANIFEST-000159

View File

@ -1,5 +1,5 @@
2021/05/12-13:31:06.024 5b98 Recovering log #104
2021/05/12-13:31:06.024 5b98 Level-0 table #106: started
2021/05/12-13:31:06.030 5b98 Level-0 table #106: 546 bytes OK
2021/05/12-13:31:06.046 5b98 Delete type=0 #104
2021/05/12-13:31:06.049 5b98 Delete type=3 #102
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

View File

@ -1,5 +1,5 @@
2021/05/12-13:27:51.851 52b8 Recovering log #100
2021/05/12-13:27:51.851 52b8 Level-0 table #103: started
2021/05/12-13:27:51.866 52b8 Level-0 table #103: 202 bytes OK
2021/05/12-13:27:51.884 52b8 Delete type=0 #100
2021/05/12-13:27:51.887 52b8 Delete type=3 #98
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

Binary file not shown.

BIN
bot2019.db/MANIFEST-000159 Normal file

Binary file not shown.

View File

@ -1,6 +1,7 @@
const DiscordClient = require("./DiscordClient");
const Color = require('./Color');
const crypto = require('crypto');
const fs = require('fs');
module.exports = (bot) => {
bot.addCommand = async (cmd, minargs, func, hidden) => {
@ -18,8 +19,6 @@ module.exports = (bot) => {
var newfish = require("./newfish.json");
var pokedex = [];
var sendChat = DiscordClient.sendChat;
var blockHelpUntil = 0;
@ -288,15 +287,21 @@ module.exports = (bot) => {
function findParticipantByNameCaseInsensitive(name) {
if(!name || name.trim() == "") return undefined;
var part = findParticipantByName(name);
// if(!part) {
// name_lc = name.toLowerCase();
// for(var id in client.ppl) {
// if(client.ppl.hasOwnProperty(id) && client.ppl[id].name.toLowerCase() === name_lc) {
// part = client.ppl[id];
// break;
// }
// }
// }
if(!part) {
name_lc = name.toLowerCase();
DiscordClient.client.guilds.cache.get('841331769051578413').members.cache.forEach(p => {
if (p.user.username.toLowerCase() === name_lc) {
part = p.user;
part.name = p.user.name;
part._id = p.user.id;
DiscordClient.client.guilds.cache.get('841331769051578413').roles.cache.forEach(r => {
if (r.name === part._id) {
part.color = r.color;
}
});
}
});
}
return part;
};
@ -799,7 +804,7 @@ module.exports = (bot) => {
var color = "#"+rrggbbrand()+rrggbbrand()+rrggbbrand();
// client.sendArray([{m: "admin message", password: "amogus",
// msg: {m: "color", _id: msg.p._id, color: color}}]);
DiscordClient.client.guilds.cache.get("841331769051578413").roles.forEach(r => {
DiscordClient.client.guilds.cache.get("841331769051578413").roles.cache.forEach(r => {
if (r.name == msg.p._id) {
r.edit({
color: color
@ -981,7 +986,7 @@ module.exports = (bot) => {
});
}, false);
bot.addCommand('/grow_fruit', 0, (msg, admin) => {
bot.addCommand('grow_fruit', 0, (msg, admin) => {
if (!admin) return;
var how_many = ~~args[0];
if(!how_many) how_many = 1;
@ -991,6 +996,81 @@ module.exports = (bot) => {
});
}, false);
var TOO_MANY_FISH = 50;
bot.addCommand('take', 0, msg => {
db.getLocation(msg.p._id, location => {
var target = msg.argcat().toLowerCase().trim();
if(!target.length) {
sendChat("Take what?");
return;
}
db.take(location, target, function(entry) {
if(!entry) {
sendChat("Friend "+msg.p.name+": You can't take "+target+" from "+location+".");
} else {
db.getFish(msg.p._id, function(myfish) {
if(myfish.length >= TOO_MANY_FISH) {
sendChat("Friend "+msg.p.name+" is carrying too much.");
} else {
var fish = entry.key;
fish = fish.substr(fish.indexOf("◍")+1);
myfish.push(fish);
db.putFish(msg.p._id, myfish);
db.del(entry.key);
sendChat("Friend "+msg.p.name+" took the "+fish+".");
};
});
}
});
});
}, false);
bot.addCommand('give', 0, msg => {
var thief = msg.p;
var victim = findParticipantByNameFuzzy(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 = 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.");
}
});
});
}, false);
setInterval(function() {
db.put("look.outside.◍Sand", "We don't talk about that.");
}, 6000);
@ -1016,6 +1096,7 @@ module.exports = (bot) => {
DiscordClient.client.guilds.cache.get('841331769051578413').members.cache.forEach(p => {
if (p.user.id === user_id) {
part = p.user;
part.name = p.user.username;
part._id = p.user.id;
if(typeof part !== 'undefined') {
catchSomething(part);