Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/chat-client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ declare class Chat extends ClientBase {
listCommands(lookup: AdvertisementsLookup): Promise<{
commands: chat1.UserBotCommandOutput[];
}>;
/**
* Crashes the app
* @example
* await bot.chat.crash()
*/
crash(): Promise<void>;
/**
* Listens for new chat messages on a specified channel. The `onMessage` function is called for every message your bot receives. This is pretty similar to `watchAllChannelsForNewMessages`, except it specifically checks one channel. Note that it receives messages your own bot posts, but from other devices. You can filter out your own messages by looking at a message's sender object.
* Hides exploding messages by default.
Expand Down
24 changes: 24 additions & 0 deletions lib/chat-client/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/chat-client/index.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/utils/adminDebugLogger.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/utils/adminDebugLogger.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/utils/keybaseExec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/utils/keybaseExec.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/chat-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,19 @@ class Chat extends ClientBase {
return {commands: res.commands || []}
}

/**
* Crashes the app
* @example
* await bot.chat.crash()
*/
public async crash(): Promise<void> {
await this._guardInitialized()
const res = await this._runApiCommand({apiName: 'chat', method: 'crash'})
if (!res) {
throw new Error('Keybase chat API crash command returned nothing.')
}
}

/**
* Listens for new chat messages on a specified channel. The `onMessage` function is called for every message your bot receives. This is pretty similar to `watchAllChannelsForNewMessages`, except it specifically checks one channel. Note that it receives messages your own bot posts, but from other devices. You can filter out your own messages by looking at a message's sender object.
* Hides exploding messages by default.
Expand Down
3 changes: 2 additions & 1 deletion src/utils/adminDebugLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export class AdminDebugLogger {
await this._logIt(text, 'I')
}
private async _logIt(text: string, code: 'E' | 'I'): Promise<void> {
const line = `${new Date().toISOString()} [${code}] ${text}${os.EOL}`
console.log(line)
if (this.directory) {
const line = `${new Date().toISOString()} [${code}] ${text}${os.EOL}`
await promisify(appendFile)(this.filename, line, 'utf-8')
}
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/keybaseExec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const keybaseExec = (
return reject(new Error(errorMessage))
} else {
const stdout = Buffer.concat(stdOutBuffer).toString('utf8')
console.log(stdout)

try {
finalStdOut = options.json ? JSON.parse(stdout) : stdout
Expand Down