@@ -99,7 +99,7 @@ func (h *Handlers) CreateBot(c echo.Context) error {
9999 return herror .InternalServerError (err )
100100 }
101101
102- return c .JSON (http .StatusCreated , formatBotDetail (b , t , make ([]uuid.UUID , 0 )))
102+ return c .JSON (http .StatusCreated , formatBotDetail (b , t . AccessToken , make ([]uuid.UUID , 0 )))
103103}
104104
105105// GetBot GET /bots/:botID
@@ -108,6 +108,7 @@ func (h *Handlers) GetBot(c echo.Context) error {
108108
109109 if isTrue (c .QueryParam ("detail" )) {
110110 user := getRequestUser (c )
111+ var accessToken string
111112
112113 // アクセス権確認
113114 if ! h .RBAC .IsGranted (user .GetRole (), permission .AccessOthersBot ) && b .CreatorID != user .GetID () {
@@ -116,20 +117,19 @@ func (h *Handlers) GetBot(c echo.Context) error {
116117
117118 t , err := h .Repo .GetTokenByID (b .AccessTokenID )
118119 if err != nil {
119- switch err {
120- case repository .ErrNotFound :
121- return herror .HTTPError (http .StatusInternalServerError , "This bot's Access Token has been revoked unexpectedly. Please inform admin about this error." )
122- default :
120+ if err != repository .ErrNotFound {
123121 return herror .InternalServerError (err )
124122 }
123+ } else {
124+ accessToken = t .AccessToken
125125 }
126126
127127 ids , err := h .Repo .GetParticipatingChannelIDsByBot (b .ID )
128128 if err != nil {
129129 return herror .InternalServerError (err )
130130 }
131131
132- return c .JSON (http .StatusOK , formatBotDetail (b , t , ids ))
132+ return c .JSON (http .StatusOK , formatBotDetail (b , accessToken , ids ))
133133 }
134134
135135 return c .JSON (http .StatusOK , formatBot (b ))
0 commit comments