fmt on src folder

This commit is contained in:
Skillz
2020-08-07 10:13:07 -04:00
parent 602337bc2c
commit 8cf4f137b9
7 changed files with 23 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
let VERSION = 'v7'
let VERSION = "v7";
export const baseEndpoints = {
/** Although, the version can be defaulted, keep the v6 as it can be changed to test newer versions when necessary. */
@@ -7,7 +7,7 @@ export const baseEndpoints = {
};
export function changeAPIVersion(number = 7) {
VERSION = `v${number}`
VERSION = `v${number}`;
}
const GUILDS_BASE = (id: string) => `${baseEndpoints.BASE_URL}/guilds/${id}`;

View File

@@ -130,8 +130,11 @@ export async function sendMessage(
}
}
if (content.embed && !botHasChannelPermissions(channel.id, [Permissions.EMBED_LINKS])) {
throw new Error(Errors.MISSING_EMBED_LINKS)
if (
content.embed &&
!botHasChannelPermissions(channel.id, [Permissions.EMBED_LINKS])
) {
throw new Error(Errors.MISSING_EMBED_LINKS);
}
// Use ... for content length due to unicode characters and js .length handling

View File

@@ -259,7 +259,7 @@ export async function createGuildRole(
const roleData = result as RoleData;
const role = createRole(roleData);
const guild = cache.guilds.get(guildID)
const guild = cache.guilds.get(guildID);
guild?.roles.set(role.id, role);
return role;
}
@@ -511,7 +511,7 @@ export function channelHasPermissions(
const role = guild.roles.get(roleID);
if (!role) return bits;
bits |= BigInt(role.permissions_new)
bits |= BigInt(role.permissions_new);
return bits;
}, BigInt(0));

View File

@@ -104,7 +104,11 @@ export function removeAllReactions(channelID: string, messageID: string) {
}
/** Removes all reactions for a single emoji on this message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */
export function removeReactionEmoji(channelID: string, messageID: string, reaction: string) {
export function removeReactionEmoji(
channelID: string,
messageID: string,
reaction: string,
) {
if (
!botHasChannelPermissions(channelID, [Permissions.MANAGE_MESSAGES])
) {

View File

@@ -96,12 +96,12 @@ export enum ChannelTypes {
export interface MessageContent {
mentions?: {
/** An array of allowed mention types to parse from the content. */
parse: ("roles" | "users" | "everyone")[],
parse: ("roles" | "users" | "everyone")[];
/** Array of role_ids to mention (Max size of 100) */
roles?: string[],
roles?: string[];
/** Array of user_ids to mention (Max size of 100) */
users?: string[]
},
users?: string[];
};
/** The message contents, up to 2000 characters */
content?: string;
/** A nonce that can be used for optimistic message sending. */
@@ -109,7 +109,7 @@ export interface MessageContent {
/** Whether this is a TextToSpeech message */
tts?: boolean;
/** The contents of the file being sent */
file?: { blob: unknown, name: string };
file?: { blob: unknown; name: string };
/** Embed object */
embed?: Embed;
/** JSON encoded body of any additional request fields. */

View File

@@ -4,7 +4,7 @@ import { RoleData } from "./role.ts";
import { MemberCreatePayload } from "./member.ts";
import { Activity } from "./message.ts";
import { ClientStatusPayload } from "./presence.ts";
import { ChannelCreatePayload } from "./channel.ts";
import { ChannelCreatePayload, ChannelTypes } from "./channel.ts";
export interface GuildRolePayload {
/** The id of the guild */
@@ -446,14 +446,6 @@ export enum AuditLogs {
INTEGRATION_DELETE,
}
export type ChannelTypeText =
| "text"
| "dm"
| "news"
| "voice"
| "category"
| "store";
export interface Overwrite {
/** The role or user id */
id: string;
@@ -482,7 +474,7 @@ export interface RawOverwrite {
export interface ChannelCreateOptions {
/** The type of the channel */
type?: ChannelTypeText;
type?: ChannelTypes;
/** The channel topic. (0-1024 characters) */
topic?: string;
/** The bitrate(in bits) of the voice channel. */

View File

@@ -20,7 +20,7 @@ export function memberHasPermission(
guild.roles.get(id)?.permissions_new
)
.reduce((bits, permissions) => {
bits |= BigInt(permissions)
bits |= BigInt(permissions);
return bits;
}, BigInt(0));
@@ -41,7 +41,7 @@ export function botHasPermission(guildID: string, permissions: Permissions[]) {
const permissionBits = member.roles
.map((id) => guild.roles.get(id)!)
.reduce((bits, data) => {
bits |= BigInt(data.permissions_new)
bits |= BigInt(data.permissions_new);
return bits;
}, BigInt(0));