提交 254cee44 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

Fix empty string not clean the announce problem (#1902)

上级 fcec6e7a
...@@ -933,13 +933,17 @@ export class Room extends Accessory implements Sayable { ...@@ -933,13 +933,17 @@ export class Room extends Accessory implements Sayable {
* console.log(`room announce change from ${oldAnnounce} to ${room.announce()}`) * console.log(`room announce change from ${oldAnnounce} to ${room.announce()}`)
*/ */
public async announce (text?: string): Promise<void | string> { public async announce (text?: string): Promise<void | string> {
log.verbose('Room', 'announce(%s)', text || '') log.verbose('Room', 'announce(%s)',
typeof text === 'undefined'
? ''
: `"${text || ''}"`
)
if (text) { if (typeof text === 'undefined') {
await this.puppet.roomAnnounce(this.id, text)
} else {
const announcement = await this.puppet.roomAnnounce(this.id) const announcement = await this.puppet.roomAnnounce(this.id)
return announcement return announcement
} else {
await this.puppet.roomAnnounce(this.id, text)
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册