mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
fix bugs
This commit is contained in:
@@ -211,10 +211,12 @@ export async function sendMessage(
|
|||||||
allowed_mentions: content.mentions
|
allowed_mentions: content.mentions
|
||||||
? {
|
? {
|
||||||
...content.mentions,
|
...content.mentions,
|
||||||
replied_user: content.mentions.repliedUser === true,
|
replied_user: content.mentions.repliedUser !== false,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
message_reference: content.replyMessageID,
|
message_reference: {
|
||||||
|
message_id: content.replyMessageID,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -321,29 +321,36 @@ function handleStatusCode(response: Response, errorStack?: unknown) {
|
|||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case HttpResponseCode.BadRequest:
|
case HttpResponseCode.BadRequest:
|
||||||
throw new Error(
|
console.error(
|
||||||
"The request was improperly formatted, or the server couldn't understand it.",
|
"The request was improperly formatted, or the server couldn't understand it.",
|
||||||
);
|
);
|
||||||
|
throw errorStack;
|
||||||
case HttpResponseCode.Unauthorized:
|
case HttpResponseCode.Unauthorized:
|
||||||
throw new Error("The Authorization header was missing or invalid.");
|
console.error("The Authorization header was missing or invalid.");
|
||||||
|
throw errorStack;
|
||||||
case HttpResponseCode.Forbidden:
|
case HttpResponseCode.Forbidden:
|
||||||
throw new Error(
|
console.error(
|
||||||
"The Authorization token you passed did not have permission to the resource.",
|
"The Authorization token you passed did not have permission to the resource.",
|
||||||
);
|
);
|
||||||
|
throw errorStack;
|
||||||
case HttpResponseCode.NotFound:
|
case HttpResponseCode.NotFound:
|
||||||
throw new Error("The resource at the location specified doesn't exist.");
|
console.error("The resource at the location specified doesn't exist.");
|
||||||
|
throw errorStack;
|
||||||
case HttpResponseCode.MethodNotAllowed:
|
case HttpResponseCode.MethodNotAllowed:
|
||||||
throw new Error(
|
console.error(
|
||||||
"The HTTP method used is not valid for the location specified.",
|
"The HTTP method used is not valid for the location specified.",
|
||||||
);
|
);
|
||||||
|
throw errorStack;
|
||||||
case HttpResponseCode.GatewayUnavailable:
|
case HttpResponseCode.GatewayUnavailable:
|
||||||
throw new Error(
|
console.error(
|
||||||
"There was not a gateway available to process your request. Wait a bit and retry.",
|
"There was not a gateway available to process your request. Wait a bit and retry.",
|
||||||
);
|
);
|
||||||
}
|
throw errorStack;
|
||||||
|
|
||||||
// left are all unknown
|
// left are all unknown
|
||||||
throw new Error(Errors.REQUEST_UNKNOWN_ERROR);
|
default:
|
||||||
|
console.error(Errors.REQUEST_UNKNOWN_ERROR);
|
||||||
|
throw errorStack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function processHeaders(url: string, headers: Headers) {
|
function processHeaders(url: string, headers: Headers) {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export interface MessageContent {
|
|||||||
roles?: string[];
|
roles?: string[];
|
||||||
/** Array of user_ids to mention (Max size of 100) */
|
/** Array of user_ids to mention (Max size of 100) */
|
||||||
users?: string[];
|
users?: string[];
|
||||||
/** Should the message author from the original message be mention. By default this is false. */
|
/** Should the message author from the original message be mention. By default this is true. */
|
||||||
repliedUser?: boolean;
|
repliedUser?: boolean;
|
||||||
};
|
};
|
||||||
/** The message contents, up to 2000 characters */
|
/** The message contents, up to 2000 characters */
|
||||||
|
|||||||
Reference in New Issue
Block a user