add basic usable version, delete leaderboard and daily commands, for now

This commit is contained in:
Santiago Forero 2021-09-08 12:24:01 -05:00
parent afd621e6c1
commit 82879e7587
7 changed files with 1083 additions and 5 deletions

2
.gitignore vendored
View File

@ -118,3 +118,5 @@ dist
.yarn/install-state.gz
.pnp.*
# databases
json.sqlite

20
commands/grow.js Normal file
View File

@ -0,0 +1,20 @@
const db = require('quick.db')
module.exports = {
name: 'grow',
description: 'Grow your cactus.',
execute(event, args, bot) {
if(db.get(event.nick + '_score') == null) db.set(event.nick + '_score', 0)
if(db.get(event.nick + '_hpg') == null) db.set(event.nick + '_hpg', 2)
db.add(event.nick + '_score', db.get(event.nick + '_hpg'))
bot.say(event.target, "You grew " + db.get(event.nick + '_hpg') + " cm")
bot.say(event.target, "You are now " + db.get(event.nick + '_score') + " cm")
},
};

View File

@ -1,7 +1,13 @@
module.exports = {
name: 'help',
description: 'Get information about this bot.',
description: 'Get info and help about this bot.',
execute(event, args, bot) {
bot.say(event.target, 'Hi, I\'m Cactus, you can live the life of a cactus and grow to become the tallest! My maintainer is forero, my prefix is \'=\' and my commands are: ')
bot.commands.forEach((value, key, map) => {
bot.say(event.target, value.name + ": " + value.description)
})
bot.say(event.target, 'Source: https://tildegit.org/forero/cactus-irc/')
},
};

20
commands/profile.js Normal file
View File

@ -0,0 +1,20 @@
const db = require('quick.db')
module.exports = {
name: 'profile',
description: 'See your profile or someone else\'s profile.',
execute(event, args, bot) {
user = args[0] || event.nick;
bot.say(event.target, user + "' profile")
if(db.get(user + '_score') == null) db.set(user + '_score', 0)
if(db.get(user + '_hpg') == null) db.set(user + '_hpg', 2)
bot.say(event.target, 'Current height: ' + db.get(user + '_score') + ' cm')
bot.say(event.target, "Height per growth: " + db.get(user + '_hpg') + " cm")
},
};

View File

@ -23,10 +23,13 @@ for (const file of commandFiles) {
}
bot.on('message', event => {
if(event.message == '!botlist') return bot.say(event.target, 'Hi, I\'m Cactus, you can live the life of a cactus and grow to become the tallest! My maintainer is forero, my prefix is \'=\' and my commands are: ')
const args = event.message.slice(prefix.length).trim().split(/ +/);
if(event.message == '!botlist') {
bot.commands.get('help').execute(event, args, bot);
}
if (!event.message.startsWith(prefix)) return;
const args = event.message.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
const command = bot.commands.get(commandName)

1028
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@
"author": "Santiago Forero",
"license": "MIT",
"dependencies": {
"irc-framework": "^4.11.0"
"irc-framework": "^4.11.0",
"quick.db": "^7.1.3"
}
}