refactor: rename *ID to *Id (#710)

* refactor: rename *ID to *Id

* Update src/helpers/commands/delete_slash_command.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/delete_slash_command.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/delete_slash_response.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/edit_slash_response.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/get_slash_command.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/send_interaction_response.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/upsert_slash_command.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/guilds/edit_widget.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/guilds/get_widget.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/guilds/get_widget.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/guilds/get_widget_image_url.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/guilds/get_widget_image_url.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/guilds/get_widget_settings.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update .gitignore

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update LICENSE

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/members/edit_bot_profile.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/members/edit_bot_profile.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/webhooks/create_webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/webhooks/delete_webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/constants.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/webhooks/edit_webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/webhooks/execute_webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/webhooks/get_webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/rest/cache.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/rest/request.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/constants.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/helpers/commands/delete_slash_response.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/constants.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/constants.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/constants.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/constants.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/util/utils.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Revert docs file

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
This commit is contained in:
ayntee
2021-03-29 21:03:46 +04:00
committed by GitHub
parent 618d30b65d
commit eaff54f90f
138 changed files with 895 additions and 908 deletions
+2 -2
View File
@@ -3,8 +3,8 @@ import { endpoints } from "../../util/constants.ts";
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.
*/
export async function deleteServer(guildID: string) {
const result = await RequestManager.delete(endpoints.GUILDS_BASE(guildID));
export async function deleteServer(guildId: string) {
const result = await RequestManager.delete(endpoints.GUILDS_BASE(guildId));
return result;
}
+3 -3
View File
@@ -4,8 +4,8 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { urlToBase64 } from "../../util/utils.ts";
/** Modify a guilds settings. Requires the MANAGE_GUILD permission. */
export async function editGuild(guildID: string, options: GuildEditOptions) {
await requireBotGuildPermissions(guildID, ["MANAGE_GUILD"]);
export async function editGuild(guildId: string, options: GuildEditOptions) {
await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
if (options.icon && !options.icon.startsWith("data:image/")) {
options.icon = await urlToBase64(options.icon);
@@ -20,7 +20,7 @@ export async function editGuild(guildID: string, options: GuildEditOptions) {
}
const result = await RequestManager.patch(
endpoints.GUILDS_BASE(guildID),
endpoints.GUILDS_BASE(guildId),
options,
);
+5 -5
View File
@@ -4,15 +4,15 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts";
/** Modify a guild widget object for the guild. Requires the MANAGE_GUILD permission. */
export async function editWidget(
guildID: string,
guildId: string,
enabled: boolean,
channelID?: string | null,
channelId?: string | null,
) {
await requireBotGuildPermissions(guildID, ["MANAGE_GUILD"]);
await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
const result = await RequestManager.patch(endpoints.GUILD_WIDGET(guildID), {
const result = await RequestManager.patch(endpoints.GUILD_WIDGET(guildId), {
enabled,
channel_id: channelID,
channel_id: channelId,
});
return result;
+3 -3
View File
@@ -4,12 +4,12 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts";
/** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */
export async function getAuditLogs(
guildID: string,
guildId: string,
options: GetAuditLogsOptions,
) {
await requireBotGuildPermissions(guildID, ["VIEW_AUDIT_LOG"]);
await requireBotGuildPermissions(guildId, ["VIEW_AUDIT_LOG"]);
const result = await RequestManager.get(endpoints.GUILD_AUDIT_LOGS(guildID), {
const result = await RequestManager.get(endpoints.GUILD_AUDIT_LOGS(guildId), {
...options,
action_type: options.action_type
? AuditLogs[options.action_type]
+3 -3
View File
@@ -3,11 +3,11 @@ import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
/** Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission. */
export async function getBan(guildID: string, memberID: string) {
await requireBotGuildPermissions(guildID, ["BAN_MEMBERS"]);
export async function getBan(guildId: string, memberId: string) {
await requireBotGuildPermissions(guildId, ["BAN_MEMBERS"]);
const result = await RequestManager.get(
endpoints.GUILD_BAN(guildID, memberID),
endpoints.GUILD_BAN(guildId, memberId),
);
return result as BannedUser;
+3 -3
View File
@@ -4,11 +4,11 @@ import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
/** Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission. */
export async function getBans(guildID: string) {
await requireBotGuildPermissions(guildID, ["BAN_MEMBERS"]);
export async function getBans(guildId: string) {
await requireBotGuildPermissions(guildId, ["BAN_MEMBERS"]);
const results = (await RequestManager.get(
endpoints.GUILD_BANS(guildID),
endpoints.GUILD_BANS(guildId),
)) as BannedUser[];
return new Collection<string, BannedUser>(
+2 -2
View File
@@ -8,8 +8,8 @@ import { endpoints } from "../../util/constants.ts";
* This function fetches a guild's data. This is not the same data as a GUILD_CREATE.
* So it does not cache the guild, you must do it manually.
* */
export async function getGuild(guildID: string, counts = true) {
const result = await RequestManager.get(endpoints.GUILDS_BASE(guildID), {
export async function getGuild(guildId: string, counts = true) {
const result = await RequestManager.get(endpoints.GUILDS_BASE(guildId), {
with_counts: counts,
});
+2 -2
View File
@@ -2,8 +2,8 @@ import { RequestManager } from "../../rest/request_manager.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the guild preview object for the given id. If the bot is not in the guild, then the guild must be Discoverable. */
export async function getGuildPreview(guildID: string) {
const result = await RequestManager.get(endpoints.GUILD_PREVIEW(guildID));
export async function getGuildPreview(guildId: string) {
const result = await RequestManager.get(endpoints.GUILD_PREVIEW(guildId));
return result;
}
+4 -4
View File
@@ -1,19 +1,19 @@
import { RequestManager } from "../../rest/request_manager.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase, urlToBase64 } from "../../util/utils.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
/** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */
export async function getPruneCount(guildID: string, options?: PruneOptions) {
export async function getPruneCount(guildId: string, options?: PruneOptions) {
if (options?.days && options.days < 1) throw new Error(Errors.PRUNE_MIN_DAYS);
if (options?.days && options.days > 30) {
throw new Error(Errors.PRUNE_MAX_DAYS);
}
await requireBotGuildPermissions(guildID, ["KICK_MEMBERS"]);
await requireBotGuildPermissions(guildId, ["KICK_MEMBERS"]);
const result = await RequestManager.get(
endpoints.GUILD_PRUNE(guildID),
endpoints.GUILD_PRUNE(guildId),
camelKeysToSnakeCase(options ?? {}),
) as PrunePayload;
+2 -2
View File
@@ -2,8 +2,8 @@ import { RequestManager } from "../../rest/request_manager.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the code and uses of the vanity url for this server if it is enabled. Requires the MANAGE_GUILD permission. */
export async function getVanityURL(guildID: string) {
const result = await RequestManager.get(endpoints.GUILD_VANITY_URL(guildID));
export async function getVanityURL(guildId: string) {
const result = await RequestManager.get(endpoints.GUILD_VANITY_URL(guildId));
return result;
}
+2 -2
View File
@@ -2,8 +2,8 @@ import { RequestManager } from "../../rest/request_manager.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled. */
export async function getVoiceRegions(guildID: string) {
const result = await RequestManager.get(endpoints.GUILD_REGIONS(guildID));
export async function getVoiceRegions(guildId: string) {
const result = await RequestManager.get(endpoints.GUILD_REGIONS(guildId));
return result;
}
+3 -3
View File
@@ -3,12 +3,12 @@ import { RequestManager } from "../../rest/request_manager.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the widget for the guild. */
export async function getWidget(guildID: string, options?: { force: boolean }) {
export async function getWidget(guildId: string, options?: { force: boolean }) {
if (!options?.force) {
const guild = await cacheHandlers.get("guilds", guildID);
const guild = await cacheHandlers.get("guilds", guildId);
if (!guild) throw new Error(Errors.GUILD_NOT_FOUND);
if (!guild?.widgetEnabled) throw new Error(Errors.GUILD_WIDGET_NOT_ENABLED);
}
return RequestManager.get(`${endpoints.GUILD_WIDGET(guildID)}.json`);
return RequestManager.get(`${endpoints.GUILD_WIDGET(guildId)}.json`);
}
+3 -3
View File
@@ -3,18 +3,18 @@ import { endpoints } from "../../util/constants.ts";
/** Returns the widget image URL for the guild. */
export async function getWidgetImageURL(
guildID: string,
guildId: string,
options?: {
style?: "shield" | "banner1" | "banner2" | "banner3" | "banner4";
force?: boolean;
},
) {
if (!options?.force) {
const guild = await cacheHandlers.get("guilds", guildID);
const guild = await cacheHandlers.get("guilds", guildId);
if (!guild) throw new Error(Errors.GUILD_NOT_FOUND);
if (!guild.widgetEnabled) throw new Error(Errors.GUILD_WIDGET_NOT_ENABLED);
}
return `${endpoints.GUILD_WIDGET(guildID)}.png?style=${options?.style ??
return `${endpoints.GUILD_WIDGET(guildId)}.png?style=${options?.style ??
"shield"}`;
}
+3 -3
View File
@@ -3,10 +3,10 @@ import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
/** Returns the guild widget object. Requires the MANAGE_GUILD permission. */
export async function getWidgetSettings(guildID: string) {
await requireBotGuildPermissions(guildID, ["MANAGE_GUILD"]);
export async function getWidgetSettings(guildId: string) {
await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
const result = await RequestManager.get(endpoints.GUILD_WIDGET(guildID));
const result = await RequestManager.get(endpoints.GUILD_WIDGET(guildId));
return result;
}
+2 -2
View File
@@ -2,8 +2,8 @@ import { RequestManager } from "../../rest/request_manager.ts";
import { endpoints } from "../../util/constants.ts";
/** Leave a guild */
export async function leaveGuild(guildID: string) {
const result = await RequestManager.delete(endpoints.GUILD_LEAVE(guildID));
export async function leaveGuild(guildId: string) {
const result = await RequestManager.delete(endpoints.GUILD_LEAVE(guildId));
return result;
}