Improve readability

This commit is contained in:
syuilo 2019-01-15 18:34:42 +09:00
parent 140d3c324d
commit cac1badb98
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -128,7 +128,10 @@ export default class 藍 {
private onMention(msg: MessageLike) {
this.log(chalk.gray(`<<< An message received: ${chalk.underline(msg.id)}`));
const context = !msg.isMessage && msg.replyId == null ? null : this.contexts.findOne(msg.isMessage ? {
const isNoContext = !msg.isMessage && msg.replyId == null;
// Look up the context
const context = isNoContext ? null : this.contexts.findOne(msg.isMessage ? {
isMessage: true,
userId: msg.userId
} : {