mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-17 19:58:18 +00:00
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:
@@ -1,4 +1,4 @@
|
||||
import { botID } from "../../bot.ts";
|
||||
import { botId } from "../../bot.ts";
|
||||
import { RequestManager } from "../../rest/request_manager.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import {
|
||||
@@ -8,24 +8,24 @@ import {
|
||||
|
||||
/** Add a role to the member */
|
||||
export async function addRole(
|
||||
guildID: string,
|
||||
memberID: string,
|
||||
roleID: string,
|
||||
guildId: string,
|
||||
memberId: string,
|
||||
roleId: string,
|
||||
reason?: string,
|
||||
) {
|
||||
const isHigherRolePosition = await isHigherPosition(
|
||||
guildID,
|
||||
botID,
|
||||
roleID,
|
||||
guildId,
|
||||
botId,
|
||||
roleId,
|
||||
);
|
||||
if (!isHigherRolePosition) {
|
||||
throw new Error(Errors.BOTS_HIGHEST_ROLE_TOO_LOW);
|
||||
}
|
||||
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.put(
|
||||
endpoints.GUILD_MEMBER_ROLE(guildID, memberID, roleID),
|
||||
endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId),
|
||||
{ reason },
|
||||
);
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ import {
|
||||
|
||||
/** Create a new role for the guild. Requires the MANAGE_ROLES permission. */
|
||||
export async function createRole(
|
||||
guildID: string,
|
||||
guildId: string,
|
||||
options: CreateRoleOptions,
|
||||
reason?: string,
|
||||
) {
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.post(endpoints.GUILD_ROLES(guildID), {
|
||||
const result = await RequestManager.post(endpoints.GUILD_ROLES(guildId), {
|
||||
...options,
|
||||
permissions: calculateBits(options?.permissions || []),
|
||||
reason,
|
||||
@@ -23,7 +23,7 @@ export async function createRole(
|
||||
|
||||
const roleData = result as RoleData;
|
||||
const role = await structures.createRoleStruct(roleData);
|
||||
const guild = await cacheHandlers.get("guilds", guildID);
|
||||
const guild = await cacheHandlers.get("guilds", guildId);
|
||||
guild?.roles.set(role.id, role);
|
||||
|
||||
return role;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
||||
|
||||
/** Delete a guild role. Requires the MANAGE_ROLES permission. */
|
||||
export async function deleteRole(guildID: string, id: string) {
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
export async function deleteRole(guildId: string, id: string) {
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.delete(endpoints.GUILD_ROLE(guildID, id));
|
||||
const result = await RequestManager.delete(endpoints.GUILD_ROLE(guildId, id));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
|
||||
/** Edit a guild role. Requires the MANAGE_ROLES permission. */
|
||||
export async function editRole(
|
||||
guildID: string,
|
||||
guildId: string,
|
||||
id: string,
|
||||
options: CreateRoleOptions,
|
||||
) {
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.patch(endpoints.GUILD_ROLE(guildID, id), {
|
||||
const result = await RequestManager.patch(endpoints.GUILD_ROLE(guildId, id), {
|
||||
...options,
|
||||
permissions: options.permissions
|
||||
? calculateBits(options.permissions)
|
||||
|
||||
@@ -6,10 +6,10 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
||||
*
|
||||
* ⚠️ **If you need this, you are probably doing something wrong. This is not intended for use. Your roles will be cached in your guild.**
|
||||
*/
|
||||
export async function getRoles(guildID: string) {
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
export async function getRoles(guildId: string) {
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.get(endpoints.GUILD_ROLES(guildID));
|
||||
const result = await RequestManager.get(endpoints.GUILD_ROLES(guildId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { botID } from "../../bot.ts";
|
||||
import { botId } from "../../bot.ts";
|
||||
import { RequestManager } from "../../rest/request_manager.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import {
|
||||
@@ -8,15 +8,15 @@ import {
|
||||
|
||||
/** Remove a role from the member */
|
||||
export async function removeRole(
|
||||
guildID: string,
|
||||
memberID: string,
|
||||
roleID: string,
|
||||
guildId: string,
|
||||
memberId: string,
|
||||
roleId: string,
|
||||
reason?: string,
|
||||
) {
|
||||
const isHigherRolePosition = await isHigherPosition(
|
||||
guildID,
|
||||
botID,
|
||||
roleID,
|
||||
guildId,
|
||||
botId,
|
||||
roleId,
|
||||
);
|
||||
if (
|
||||
!isHigherRolePosition
|
||||
@@ -24,10 +24,10 @@ export async function removeRole(
|
||||
throw new Error(Errors.BOTS_HIGHEST_ROLE_TOO_LOW);
|
||||
}
|
||||
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.delete(
|
||||
endpoints.GUILD_MEMBER_ROLE(guildID, memberID, roleID),
|
||||
endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId),
|
||||
{ reason },
|
||||
);
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
||||
|
||||
/** Modify the positions of a set of role objects for the guild. Requires the MANAGE_ROLES permission. */
|
||||
export async function swapRoles(guildID: string, rolePositons: PositionSwap) {
|
||||
await requireBotGuildPermissions(guildID, ["MANAGE_ROLES"]);
|
||||
export async function swapRoles(guildId: string, rolePositons: PositionSwap) {
|
||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
const result = await RequestManager.patch(
|
||||
endpoints.GUILD_ROLES(guildID),
|
||||
endpoints.GUILD_ROLES(guildId),
|
||||
rolePositons,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user