diff options
| author | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-03-27 16:51:12 +0900 |
|---|---|---|
| committer | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-03-27 23:51:21 +0900 |
| commit | 68ce6d574882c1badbb4a3d2772451534014dd01 (patch) | |
| tree | 3b468556c25dd5b63e3774aca1869b71dd9b1919 /src/api/bot/interfaces | |
| parent | Merge pull request #1316 from akihikodaki/host (diff) | |
| download | sharkey-68ce6d574882c1badbb4a3d2772451534014dd01.tar.gz sharkey-68ce6d574882c1badbb4a3d2772451534014dd01.tar.bz2 sharkey-68ce6d574882c1badbb4a3d2772451534014dd01.zip | |
Implement remote account resolution
Diffstat (limited to 'src/api/bot/interfaces')
| -rw-r--r-- | src/api/bot/interfaces/line.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/api/bot/interfaces/line.ts b/src/api/bot/interfaces/line.ts index 6b2ebdec88..8036b2fde4 100644 --- a/src/api/bot/interfaces/line.ts +++ b/src/api/bot/interfaces/line.ts @@ -7,6 +7,8 @@ import config from '../../../conf'; import BotCore from '../core'; import _redis from '../../../db/redis'; import prominence = require('prominence'); +import getAcct from '../../../common/user/get-acct'; +import parseAcct from '../../../common/user/parse-acct'; import getPostSummary from '../../../common/get-post-summary'; const redis = prominence(_redis); @@ -98,10 +100,9 @@ class LineBot extends BotCore { } public async showUserCommand(q: string) { - const user = await require('../../endpoints/users/show')({ - username: q.substr(1) - }, this.user); + const user = await require('../../endpoints/users/show')(parseAcct(q.substr(1)), this.user); + const acct = getAcct(user); const actions = []; actions.push({ @@ -121,7 +122,7 @@ class LineBot extends BotCore { actions.push({ type: 'uri', label: 'Webで見る', - uri: `${config.url}/@${user.username}` + uri: `${config.url}/@${acct}` }); this.reply([{ @@ -130,7 +131,7 @@ class LineBot extends BotCore { template: { type: 'buttons', thumbnailImageUrl: `${user.avatar_url}?thumbnail&size=1024`, - title: `${user.name} (@${user.username})`, + title: `${user.name} (@${acct})`, text: user.description || '(no description)', actions: actions } @@ -171,6 +172,7 @@ module.exports = async (app: express.Application) => { if (session == null) { const user = await User.findOne({ + host: null, 'account.line': { user_id: sourceId } |