fix: forgot about message content & its post not get
This commit is contained in:
parent
26638b00d5
commit
d574281127
2 changed files with 17 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
import { ApiClient } from './apiClient';
|
||||
|
||||
import type { Client } from '../client/client';
|
||||
import type { IApiCreateMessage } from '../utils/types';
|
||||
|
||||
export class ApiHelper {
|
||||
public apiClient: ApiClient;
|
||||
|
@ -15,10 +16,11 @@ export class ApiHelper {
|
|||
this.apiClient = new ApiClient(this.client, this._token);
|
||||
}
|
||||
|
||||
public createMessage(channelId: string): void {
|
||||
this.apiClient.get({
|
||||
public createMessage(channelId: string, options: IApiCreateMessage): void {
|
||||
this.apiClient.post({
|
||||
path: `/channels/${channelId}/messages`,
|
||||
requireAuth: true,
|
||||
body: options,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,11 @@ export interface IDefaultOptions {
|
|||
clientOptions: IClientOptions;
|
||||
}
|
||||
|
||||
export interface IFile {
|
||||
file: Buffer;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IMakeRequestOptions extends IRequestOptions {
|
||||
method: ApiMethods;
|
||||
}
|
||||
|
@ -23,17 +28,19 @@ export interface IRequestOptions {
|
|||
requireAuth?: boolean;
|
||||
body?: unknown;
|
||||
headers?: Record<string, string>;
|
||||
files?: {
|
||||
file: Buffer;
|
||||
name: string;
|
||||
}[];
|
||||
files?: IFile[];
|
||||
}
|
||||
|
||||
// Api Rest Request Interfaces
|
||||
// TODO: Finish this up
|
||||
export interface IApiCreateMessage {
|
||||
content: string;
|
||||
}
|
||||
|
||||
// Enums
|
||||
|
||||
// Type Aliases
|
||||
export type ApiMethods = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT' ;
|
||||
export type Primitives = string | number | boolean | bigint | symbol | undefined | null;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type Builtin = Primitives | Function | Date | Error | RegExp;
|
||||
export type DeepRequired<T> = T extends Builtin
|
||||
|
@ -56,4 +63,4 @@ export type DeepRequired<T> = T extends Builtin
|
|||
: T extends {}
|
||||
? { [K in keyof T]-?: DeepRequired<T[K]> }
|
||||
: NonNullable<T>;
|
||||
|
||||
export type Primitives = string | number | boolean | bigint | symbol | undefined | null;
|
||||
|
|
Reference in a new issue