This commit is contained in:
Hri7566 2021-08-06 00:36:15 -04:00
parent 0fc568ebc2
commit 586e2bde99
15 changed files with 173 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bot2019.db/000194.ldb Normal file

Binary file not shown.

BIN
bot2019.db/000198.ldb Normal file

Binary file not shown.

BIN
bot2019.db/000205.ldb Normal file

Binary file not shown.

BIN
bot2019.db/000206.log Normal file

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000172
MANIFEST-000204

View File

@ -1,5 +1,5 @@
2021/08/06-00:21:15.178 7108 Recovering log #171
2021/08/06-00:21:15.179 7108 Level-0 table #173: started
2021/08/06-00:21:15.194 7108 Level-0 table #173: 1044 bytes OK
2021/08/06-00:21:15.213 7108 Delete type=0 #171
2021/08/06-00:21:15.216 7108 Delete type=3 #169
2021/08/06-00:35:25.097 6b0c Recovering log #203
2021/08/06-00:35:25.097 6b0c Level-0 table #205: started
2021/08/06-00:35:25.105 6b0c Level-0 table #205: 316 bytes OK
2021/08/06-00:35:25.121 6b0c Delete type=0 #203
2021/08/06-00:35:25.124 6b0c Delete type=3 #202

View File

@ -1,5 +1,3 @@
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
2021/08/06-00:34:35.908 5ec4 Recovering log #201
2021/08/06-00:34:35.923 5ec4 Delete type=0 #201
2021/08/06-00:34:35.925 5ec4 Delete type=3 #200

Binary file not shown.

BIN
bot2019.db/MANIFEST-000204 Normal file

Binary file not shown.

View File

@ -1,3 +1,4 @@
const { sendChat } = require('./DiscordClient');
const DiscordClient = require('./DiscordClient');
const StaticEventEmitter = require('./StaticEventEmitter');
@ -42,12 +43,172 @@ module.exports = class Bot extends StaticEventEmitter {
msg.p = {
name: msg.author.username,
_id: msg.author.id,
color: role.color
color: role.color,
id: msg.author.id
}
msg.a = msg.content;
if(msg.a[0] == "" && msg.p.id !== client.participantId) {
msg.a[0] = "/";
}
function findParticipantByName(name) {
// if(!name || name.trim() == "") return undefined;
// for(var id in client.ppl) {
// if(client.ppl.hasOwnProperty(id) && client.ppl[id].name === name) {
// return client.ppl[id];
// }
// }
return undefined;
};
function findParticipantByNameCaseInsensitive(name) {
if(!name || name.trim() == "") return undefined;
var part = findParticipantByName(name);
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;
};
function findParticipantByNameFuzzy(name) {
if(!name || name.trim() == "") return undefined;
name = name.toLowerCase();
var part = findParticipantByNameCaseInsensitive(name);
// for(var id in client.ppl) {
// if(client.ppl.hasOwnProperty(id) && client.ppl[id].name.toLowerCase().indexOf(name) === 0) {
// part = client.ppl[id];
// break;
// }
// }
// for(var id in client.ppl) {
// if(client.ppl.hasOwnProperty(id) && client.ppl[id].name.toLowerCase().indexOf(name) !== -1) {
// part = client.ppl[id];
// break;
// }
// }
return part;
};
if (msg.cmd.startsWith("give_")) {
// var amt = parseInt(msg.cmd.substr(5));
// console.log(msg.cmd.substr(5));
// if(amt > 0) {
// console.log('test');
// if(amt > 100 && msg.p.id !== client.participantId) {
// sendChat("Friend "+msg.p.name+": you can only give up to 100 at a time.");
// } else {
// 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 arg = target_fish.trim().toLowerCase();
// var thefish = "items";
// for(var j = 0; j < amt; j++) {
// var idx = -1;
// 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 "+amt+" "+arg+".");
// return;
// }
// thefish = thief_fish[idx];
// thief_fish.splice(idx, 1);
// victim_fish.push(thefish);
// }
// sendChat("Our friend " +thief.name+" gave "+victim.name+" his/her e.g. ("+thefish+") x "+amt+".");
// 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;
// }
// }
return sendChat("You may not /give_, it misses every time.");
}
if (msg.cmd.startsWith("bestow_")) {
// var amt = parseInt(msg.cmd.substr(8));
// if(amt > 0) {
// if(amt > 100 && msg.p.id !== client.participantId) {
// sendChat("Friend "+msg.p.name+": you can only bestow up to 100 at a time.");
// } else {
// var thief = msg.p;
// var victim = client.ppl[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 arg = target_fish.trim().toLowerCase();
// var thefish = "items";
// for(var j = 0; j < amt; j++) {
// var idx = -1;
// 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 "+amt+" "+arg+".");
// return;
// }
// thefish = thief_fish[idx];
// thief_fish.splice(idx, 1);
// victim_fish.push(thefish);
// }
// sendChat("Our friend " +thief.name+" bestowed "+victim.name+" his/her e.g. ("+thefish+") x "+amt+".");
// 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;
// }
// }
return sendChat("You may not /bestow_, it misses every time.");
}
this.commands.forEach(cmd => {
let usedCommand = false;
cmd.cmd.forEach(c => {

View File

@ -366,7 +366,8 @@ module.exports = (bot) => {
if (Date.now() < blockHelpUntil) return;
blockHelpUntil = Date.now() + 10000;
//sendChat("This is a test to see what leveldb is like. Commands: /put <key> <value>, /get <key>, /del <key>, /read [<start> [<end>]] \t"+underline("Fishing")+": \t/fish, /cast (starts fishing), /reel (stops fishing), /caught [name] (shows fish you've caught), /eat (eats one of your fish), /give [name] (gives fish to someone else), /steal [name] (steals fish from someone else)");
sendChat(underline("Fishing")+": \t/fish, /cast (starts fishing), /reel (stops fishing), /caught [name] (shows fish you've caught), /eat (eats one of your fish), /give [name] (gives fish to someone else), /give_[number] [name] (give up to 100 at a time), /pick (picks fruit from the tree), /look [object] (look at surroundings), /yeet [item] (yeet items into surroundings), /take [object] (take items from surroundings)");
// sendChat(underline("Fishing")+": \t/fish, /cast (starts fishing), /reel (stops fishing), /caught [name] (shows fish you've caught), /eat (eats one of your fish), /give [name] (gives fish to someone else), /give_[number] [name] (give up to 100 at a time), /pick (picks fruit from the tree), /look [object] (look at surroundings), /yeet [item] (yeet items into surroundings), /take [object] (take items from surroundings)");
sendChat(underline("Fishing")+": \t/fish, /cast (starts fishing), /reel (stops fishing), /caught [name] (shows fish you've caught), /eat (eats one of your fish), /give [name] (gives fish to someone else), ~~/give_[number] [name] (give up to 100 at a time)~~, /pick (picks fruit from the tree), /look [object] (look at surroundings), /yeet [item] (yeet items into surroundings), /take [object] (take items from surroundings)");
}, false);
bot.addCommand('qmyid', 0, (msg, admin) => {