|
|
|
@ -39,15 +39,34 @@ const handleCommand = async (message, command, args) => { |
|
|
|
|
await message.channel.send('no args') |
|
|
|
|
return |
|
|
|
|
}
|
|
|
|
|
db.run('INSERT INTO saved_data (msg_id,data)'+ |
|
|
|
|
'VALUES(?,?)', message.id, args[0]) |
|
|
|
|
await message.channel.send('saved "'+args[0]+'" with id '+message.id) |
|
|
|
|
db.run('INSERT INTO saved_data (msg_id,data)' + |
|
|
|
|
'VALUES(?,?)', [message.id, args[0]], async (err) =>{ |
|
|
|
|
if(err){ |
|
|
|
|
await message.channel.send(err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
await message.channel.send('saved "'+args[0]+'" with id '+message.id+'.') |
|
|
|
|
}) |
|
|
|
|
break |
|
|
|
|
case 'dump': |
|
|
|
|
//TODO: make messages be embeds to test
|
|
|
|
|
db.each('SELECT * FROM saved_data', async (err, rows) =>{ |
|
|
|
|
if(err){ |
|
|
|
|
await message.channel.send(err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
await message.channel.send(JSON.stringify(rows)) |
|
|
|
|
}) |
|
|
|
|
break; |
|
|
|
|
case 'clear': |
|
|
|
|
db.run('DELETE FROM saved_data', async (err) =>{ |
|
|
|
|
if(err){ |
|
|
|
|
await message.channel.send(err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
await message.channel.send("Cleared.") |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|