change: prettier code

This commit is contained in:
TriForMine
2021-10-18 19:04:01 +00:00
committed by GitHub Action
parent 64e316647e
commit 6ece2dc106
13 changed files with 78 additions and 42 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ import {
highestRole, highestRole,
higherRolePosition, higherRolePosition,
requireBotChannelPermissions, requireBotChannelPermissions,
requireBotGuildPermissions requireBotGuildPermissions,
} from "./util/permissions.ts"; } from "./util/permissions.ts";
import { getGatewayBot } from "./helpers/misc/get_gateway_bot.ts"; import { getGatewayBot } from "./helpers/misc/get_gateway_bot.ts";
import { import {
@@ -4,5 +4,9 @@ import {Bot} from "../../bot.ts";
export async function deleteIntegration(bot: Bot, guildId: bigint, id: bigint) { export async function deleteIntegration(bot: Bot, guildId: bigint, id: bigint) {
await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]); await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
return await bot.rest.runMethod<undefined>(bot.rest,"delete", bot.constants.endpoints.GUILD_INTEGRATION(guildId, id)); return await bot.rest.runMethod<undefined>(
bot.rest,
"delete",
bot.constants.endpoints.GUILD_INTEGRATION(guildId, id)
);
} }
+7 -2
View File
@@ -15,7 +15,11 @@ export async function createInvite(bot: Bot, channelId: bigint, options: CreateC
throw new Error(Errors.INVITE_MAX_USES_INVALID); throw new Error(Errors.INVITE_MAX_USES_INVALID);
} }
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>>(bot.rest,"post", bot.constants.endpoints.CHANNEL_INVITES(channelId), { return await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>>(
bot.rest,
"post",
bot.constants.endpoints.CHANNEL_INVITES(channelId),
{
max_age: options.maxAge, max_age: options.maxAge,
max_uses: options.maxUses, max_uses: options.maxUses,
temporary: options.temporary, temporary: options.temporary,
@@ -23,5 +27,6 @@ export async function createInvite(bot: Bot, channelId: bigint, options: CreateC
target_type: options.targetType, target_type: options.targetType,
target_user_id: options.targetUserId, target_user_id: options.targetUserId,
target_application_id: options.targetUserId, target_application_id: options.targetUserId,
}); }
);
} }
+5 -1
View File
@@ -13,5 +13,9 @@ export async function deleteInvite(bot: Bot, channelId: bigint, inviteCode: stri
} }
} }
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>>(bot.rest,"delete", bot.constants.endpoints.INVITE(inviteCode)); return await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>>(
bot.rest,
"delete",
bot.constants.endpoints.INVITE(inviteCode)
);
} }
+5 -1
View File
@@ -7,7 +7,11 @@ import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
export async function getChannelInvites(bot: Bot, channelId: bigint) { export async function getChannelInvites(bot: Bot, channelId: bigint) {
await bot.utils.requireBotChannelPermissions(channelId, ["MANAGE_CHANNELS"]); await bot.utils.requireBotChannelPermissions(channelId, ["MANAGE_CHANNELS"]);
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>[]>(bot.rest,"get", bot.constants.endpoints.CHANNEL_INVITES(channelId)); const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>[]>(
bot.rest,
"get",
bot.constants.endpoints.CHANNEL_INVITES(channelId)
);
return new Collection(result.map((invite) => [invite.code, invite])); return new Collection(result.map((invite) => [invite.code, invite]));
} }
+6 -2
View File
@@ -5,8 +5,12 @@ import {Bot} from "../../bot.ts";
/** Returns an invite for the given code or throws an error if the invite doesn't exists. */ /** Returns an invite for the given code or throws an error if the invite doesn't exists. */
export async function getInvite(bot: Bot, inviteCode: string, options?: GetInvite) { export async function getInvite(bot: Bot, inviteCode: string, options?: GetInvite) {
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>>("get", bot.constants.endpoints.INVITE(inviteCode), { return await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>>(
"get",
bot.constants.endpoints.INVITE(inviteCode),
{
with_counts: options.withCounts, with_counts: options.withCounts,
with_expiration: options.withExpiration, with_expiration: options.withExpiration,
}); }
);
} }
+4 -1
View File
@@ -7,7 +7,10 @@ import {Bot} from "../../bot.ts";
export async function getInvites(bot: Bot, guildId: bigint) { export async function getInvites(bot: Bot, guildId: bigint) {
await bot.utils.requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); await bot.utils.requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>[]>("get", bot.constants.endpoints.GUILD_INVITES(guildId)); const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<InviteMetadata>[]>(
"get",
bot.constants.endpoints.GUILD_INVITES(guildId)
);
return new Collection(result.map((invite) => [invite.code, invite])); return new Collection(result.map((invite) => [invite.code, invite]));
} }
+1 -1
View File
@@ -12,7 +12,7 @@ export function editBotStatus(bot: Bot, data: Omit<StatusUpdate, "afk" | "since"
since: null, since: null,
afk: false, afk: false,
activities: data.activities, activities: data.activities,
status: data.status status: data.status,
}, },
}); });
}); });
+5 -1
View File
@@ -4,5 +4,9 @@ import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
/** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */ /** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
export async function getGatewayBot(bot: Bot) { export async function getGatewayBot(bot: Bot) {
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<GetGatewayBot>>(bot.rest,"get", bot.constants.endpoints.GATEWAY_BOT); return await bot.rest.runMethod<SnakeCasedPropertiesDeep<GetGatewayBot>>(
bot.rest,
"get",
bot.constants.endpoints.GATEWAY_BOT
);
} }
+5 -1
View File
@@ -4,5 +4,9 @@ import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
/** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */ /** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */
export async function getUser(bot: Bot, userId: bigint) { export async function getUser(bot: Bot, userId: bigint) {
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<User>>(bot.rest,"get", bot.constants.endpoints.USER(userId)); return await bot.rest.runMethod<SnakeCasedPropertiesDeep<User>>(
bot.rest,
"get",
bot.constants.endpoints.USER(userId)
);
} }
+5 -1
View File
@@ -4,5 +4,9 @@ import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
/** Get the applications info */ /** Get the applications info */
export async function getApplicationInfo(bot: Bot) { export async function getApplicationInfo(bot: Bot) {
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<Omit<Application, "flags">>>(bot.rest,"get", bot.constants.endpoints.OAUTH2_APPLICATION); return await bot.rest.runMethod<SnakeCasedPropertiesDeep<Omit<Application, "flags">>>(
bot.rest,
"get",
bot.constants.endpoints.OAUTH2_APPLICATION
);
} }