mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-28 04:37:52 +00:00
25 lines
415 B
JavaScript
25 lines
415 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const Datastore = require('nedb-promise');
|
||
|
|
||
|
const User = new Datastore({
|
||
|
autoload: true,
|
||
|
filename: 'data/User.db'
|
||
|
});
|
||
|
|
||
|
User.ensureIndex({
|
||
|
fieldName: 'id',
|
||
|
unique: true
|
||
|
});
|
||
|
|
||
|
const addUser = ({ id, first_name = '', last_name = '', username = '' }) =>
|
||
|
User.insert({ first_name, id, last_name, username });
|
||
|
|
||
|
const isUser = ({ id }) =>
|
||
|
User.findOne({ id });
|
||
|
|
||
|
module.exports = {
|
||
|
addUser,
|
||
|
isUser
|
||
|
};
|