This commit is contained in:
syuilo
2017-10-07 06:43:36 +09:00
parent f5fe36825b
commit 1d4f9378ca
4 changed files with 105 additions and 9 deletions

View File

@@ -33,7 +33,8 @@ module.exports = async (app: express.Application) => {
});
session = new BotCore(user);
session.on('set-user', user => {
session.on('signin', user => {
User.update(user._id, {
$set: {
line: {
@@ -43,6 +44,16 @@ module.exports = async (app: express.Application) => {
});
});
session.on('signout', user => {
User.update(user._id, {
$set: {
line: {
user_id: null
}
}
});
});
redis.set(sessionId, JSON.stringify(session.export()));
} else {
session = BotCore.import(JSON.parse(_session));