kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
refactor: directly return promises instead of awaiting
rodzic
9fa5f26215
commit
a1bd7ef101
|
@ -290,13 +290,14 @@ export class SlackClient {
|
||||||
throw new Error('Error: No channel specified')
|
throw new Error('Error: No channel specified')
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await this.api.post('chat.postMessage', {
|
return this.api
|
||||||
json: {
|
.post('chat.postMessage', {
|
||||||
channel: this.defaultChannel,
|
json: {
|
||||||
...options
|
channel: this.defaultChannel,
|
||||||
}
|
...options
|
||||||
})
|
}
|
||||||
return res.json<SlackMessage>()
|
})
|
||||||
|
.json<SlackMessage>()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -305,20 +306,22 @@ export class SlackClient {
|
||||||
public async fetchConversationHistory(
|
public async fetchConversationHistory(
|
||||||
options: SlackConversationHistoryParams
|
options: SlackConversationHistoryParams
|
||||||
) {
|
) {
|
||||||
const response = await this.api.get('conversations.history', {
|
return this.api
|
||||||
searchParams: options
|
.get('conversations.history', {
|
||||||
})
|
searchParams: options
|
||||||
return response.json<SlackReplies>()
|
})
|
||||||
|
.json<SlackReplies>()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches replies to a message in a channel.
|
* Fetches replies to a message in a channel.
|
||||||
*/
|
*/
|
||||||
protected async fetchReplies(options: SlackConversationRepliesParams) {
|
protected async fetchReplies(options: SlackConversationRepliesParams) {
|
||||||
const response = await this.api.get('conversations.replies', {
|
return this.api
|
||||||
searchParams: options
|
.get('conversations.replies', {
|
||||||
})
|
searchParams: options
|
||||||
return response.json<SlackReplies>()
|
})
|
||||||
|
.json<SlackReplies>()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Ładowanie…
Reference in New Issue