undefined > void

This commit is contained in:
Skillz4Killz
2021-12-05 16:50:03 +00:00
committed by GitHub
parent a073c0741a
commit db63b7901a
33 changed files with 35 additions and 54 deletions

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts";
/** Delete the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */
export async function deleteChannelOverwrite(bot: Bot, channelId: bigint, overwriteId: bigint): Promise<undefined> {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.CHANNEL_OVERWRITE(channelId, overwriteId)

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Deletes the Stage instance. Requires the user to be a moderator of the Stage channel. */
export async function deleteStageInstance(bot: Bot, channelId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.STAGE_INSTANCE(channelId));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.STAGE_INSTANCE(channelId));
}

View File

@@ -8,7 +8,7 @@ export async function editChannelOverwrite(
overwriteId: bigint,
options: Omit<Overwrite, "id">
): Promise<undefined> {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"put",
bot.constants.endpoints.CHANNEL_OVERWRITE(channelId, overwriteId),

View File

@@ -7,5 +7,5 @@ import type { Bot } from "../../bot.ts";
* this endpoint may be called to let the user know that the bot is processing their message.
*/
export async function startTyping(bot: Bot, channelId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "post", bot.constants.endpoints.CHANNEL_TYPING(channelId));
await bot.rest.runMethod<undefined>(bot.rest, "post", bot.constants.endpoints.CHANNEL_TYPING(channelId));
}

View File

@@ -7,7 +7,7 @@ export async function swapChannels(bot: Bot, guildId: bigint, channelPositions:
throw "You must provide at least one channels to be moved.";
}
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"patch",
bot.constants.endpoints.GUILD_CHANNELS(guildId),

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts";
/** Adds a user to a thread. Requires the ability to send messages in the thread. Requires the thread is not archived. */
export async function addToThread(bot: Bot, threadId: bigint, userId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "put", bot.constants.endpoints.THREAD_USER(threadId, userId));
await bot.rest.runMethod<undefined>(bot.rest, "put", bot.constants.endpoints.THREAD_USER(threadId, userId));
}

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts";
/** Adds the bot to the thread. Cannot join an archived thread. */
export async function joinThread(bot: Bot, threadId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "put", bot.constants.endpoints.THREAD_ME(threadId));
await bot.rest.runMethod<undefined>(bot.rest, "put", bot.constants.endpoints.THREAD_ME(threadId));
}

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts";
/** Removes the bot from a thread. Requires the thread is not archived. */
export async function leaveThread(bot: Bot, threadId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.THREAD_ME(threadId));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.THREAD_ME(threadId));
}

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../../bot.ts";
/** Removes a user from a thread. Requires the MANAGE_THREADS permission or that you are the creator of the thread. Also requires the thread is not archived. */
export async function removeThreadMember(bot: Bot, threadId: bigint, userId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.THREAD_USER(threadId, userId));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.THREAD_USER(threadId, userId));
}

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts";
/** Removes a discovery subcategory from the guild. Requires the MANAGE_GUILD permission. Returns a 204 No Content on success. */
export async function removeDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId)

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts";
/** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success. */
export async function deleteEmoji(bot: Bot, guildId: bigint, id: bigint, reason?: string) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_EMOJI(guildId, id), {
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_EMOJI(guildId, id), {
reason,
});
}

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */
export async function deleteGuild(bot: Bot, guildId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILDS_BASE(guildId));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILDS_BASE(guildId));
}

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Leave a guild */
export async function leaveGuild(bot: Bot, guildId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_LEAVE(guildId));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_LEAVE(guildId));
}

View File

@@ -2,9 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Delete the attached integration object for the guild with this id. Requires MANAGE_GUILD permission. */
export async function deleteIntegration(bot: Bot, guildId: bigint, id: bigint) {
return await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.GUILD_INTEGRATION(guildId, id)
);
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_INTEGRATION(guildId, id));
}

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../../bot.ts";
/** Deletes a slash command. */
export async function deleteApplicationCommand(bot: Bot, id: bigint, guildId?: bigint) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
guildId

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../../bot.ts";
/** To delete your response to a slash command. If a message id is not provided, it will default to deleting the original response. */
export async function deleteInteractionResponse(bot: Bot, token: string, messageId?: bigint) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
messageId

View File

@@ -3,7 +3,7 @@ import type { Bot } from "../../bot.ts";
/** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */
export async function banMember(bot: Bot, guildId: bigint, id: bigint, options?: CreateGuildBan) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"put",
bot.constants.endpoints.GUILD_BAN(guildId, id),

View File

@@ -2,10 +2,7 @@ import { Bot } from "../../bot.ts";
/** Kick a member from the server */
export async function kickMember(bot: Bot, guildId: bigint, memberId: bigint, reason?: string) {
return await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.GUILD_MEMBER(guildId, memberId),
{ reason }
);
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_MEMBER(guildId, memberId), {
reason,
});
}

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Remove the ban for a user. Requires BAN_MEMBERS permission */
export async function unbanMember(bot: Bot, guildId: bigint, id: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_BAN(guildId, id));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_BAN(guildId, id));
}

View File

@@ -8,7 +8,7 @@ export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint
reaction = reaction.substring(3, reaction.length - 1);
}
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"put",
bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, encodeURIComponent(reaction)),

View File

@@ -10,7 +10,7 @@ export async function deleteMessage(
) {
if (delayMilliseconds) await bot.utils.delay(delayMilliseconds);
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.CHANNEL_MESSAGE(channelId, messageId),

View File

@@ -10,7 +10,7 @@ export async function deleteMessages(bot: Bot, channelId: bigint, ids: bigint[],
console.warn(`This endpoint only accepts a maximum of 100 messages. Deleting the first 100 message ids provided.`);
}
return await bot.rest.runMethod<undefined>(bot.rest, "post", bot.constants.endpoints.CHANNEL_BULK_DELETE(channelId), {
await bot.rest.runMethod<undefined>(bot.rest, "post", bot.constants.endpoints.CHANNEL_BULK_DELETE(channelId), {
messages: ids.splice(0, 100).map((id) => id.toString()),
reason,
});

View File

@@ -2,9 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Pin a message in a channel. Requires MANAGE_MESSAGES. Max pins allowed in a channel = 50. */
export async function pinMessage(bot: Bot, channelId: bigint, messageId: bigint) {
return await bot.rest.runMethod<undefined>(
bot.rest,
"put",
bot.constants.endpoints.CHANNEL_PIN(channelId, messageId)
);
await bot.rest.runMethod<undefined>(bot.rest, "put", bot.constants.endpoints.CHANNEL_PIN(channelId, messageId));
}

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts";
/** Removes all reactions for all emojis on this message. */
export async function removeAllReactions(bot: Bot, channelId: bigint, messageId: bigint) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.CHANNEL_MESSAGE_REACTIONS(channelId, messageId)

View File

@@ -14,7 +14,7 @@ export async function removeReaction(
reaction = reaction.substring(3, reaction.length - 1);
}
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
options?.userId

View File

@@ -8,7 +8,7 @@ export async function removeReactionEmoji(bot: Bot, channelId: bigint, messageId
reaction = reaction.substring(3, reaction.length - 1);
}
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction)

View File

@@ -2,9 +2,5 @@
import type { Bot } from "../../bot.ts";
export async function unpinMessage(bot: Bot, channelId: bigint, messageId: bigint): Promise<undefined> {
return await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.CHANNEL_PIN(channelId, messageId)
);
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.CHANNEL_PIN(channelId, messageId));
}

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts";
/** Add a role to the member */
export async function addRole(bot: Bot, guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"put",
bot.constants.endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId),

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Delete a guild role. Requires the MANAGE_ROLES permission. */
export async function deleteRole(bot: Bot, guildId: bigint, id: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_ROLE(guildId, id));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_ROLE(guildId, id));
}

View File

@@ -2,7 +2,7 @@ import type { Bot } from "../../bot.ts";
/** Remove a role from the member */
export async function removeRole(bot: Bot, guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId),

View File

@@ -2,5 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a undefined on success */
export async function deleteWebhook(bot: Bot, channelId: bigint, webhookId: bigint) {
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.WEBHOOK_ID(webhookId));
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.WEBHOOK_ID(webhookId));
}

View File

@@ -1,7 +1,7 @@
import type { Bot } from "../../bot.ts";
export async function deleteWebhookMessage(bot: Bot, webhookId: bigint, webhookToken: string, messageId: bigint) {
return await bot.rest.runMethod<undefined>(
await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.WEBHOOK_MESSAGE(webhookId, webhookToken, messageId)

View File

@@ -2,9 +2,5 @@ import type { Bot } from "../../bot.ts";
/** Delete a webhook permanently. Returns a undefined on success */
export async function deleteWebhookWithToken(bot: Bot, webhookId: bigint, webhookToken: string) {
return await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.WEBHOOK(webhookId, webhookToken)
);
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.WEBHOOK(webhookId, webhookToken));
}