add basic usable version, delete leaderboard and daily commands, for now
This commit is contained in:
parent
afd621e6c1
commit
82879e7587
|
@ -118,3 +118,5 @@ dist
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
# databases
|
||||||
|
json.sqlite
|
|
@ -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")
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,7 +1,13 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'help',
|
name: 'help',
|
||||||
description: 'Get information about this bot.',
|
description: 'Get info and help about this bot.',
|
||||||
execute(event, args, 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.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/')
|
||||||
},
|
},
|
||||||
};
|
};
|
|
@ -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")
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
7
index.js
7
index.js
|
@ -23,10 +23,13 @@ for (const file of commandFiles) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.on('message', event => {
|
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;
|
if (!event.message.startsWith(prefix)) return;
|
||||||
const args = event.message.slice(prefix.length).trim().split(/ +/);
|
|
||||||
const commandName = args.shift().toLowerCase();
|
const commandName = args.shift().toLowerCase();
|
||||||
|
|
||||||
const command = bot.commands.get(commandName)
|
const command = bot.commands.get(commandName)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,7 @@
|
||||||
"author": "Santiago Forero",
|
"author": "Santiago Forero",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"irc-framework": "^4.11.0"
|
"irc-framework": "^4.11.0",
|
||||||
|
"quick.db": "^7.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue