refactor: directly return promises instead of awaiting

old-agentic-v1^2
Philipp Burckhardt 2023-06-10 20:40:52 -04:00
rodzic 9fa5f26215
commit a1bd7ef101
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A2C3BCA4F31D1DDD
1 zmienionych plików z 18 dodań i 15 usunięć

Wyświetl plik

@ -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>()
} }
/** /**