Skip to content

Commit

Permalink
MessageEmbedOptions -> Embed
Browse files Browse the repository at this point in the history
- .npmignore Ignoring lib/ makes the library even more lightweight than it was.
  • Loading branch information
pakkographic committed Aug 13, 2024
1 parent 0cf984f commit ce4f6e4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ examples/
.npm-deprecaterc
.npm-deprecaterc.json
.eslintignore
.eslintrc.js
.eslintrc.js
.npmrc
lib/
6 changes: 3 additions & 3 deletions lib/structures/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
AnyTextableChannel,
CreateMessageOptions,
EditMessageOptions,
MessageEmbedOptions,
Embed,
RawMessage,
RawEmbed,
RawMentions
Expand Down Expand Up @@ -430,7 +430,7 @@ export class Message<T extends AnyTextableChannel> extends Base<string> {
/** Edit the last message sent with the message itself.
* @param newMessage New message's options.
*/
async editLast(newMessage: {content?: string; embeds?: Array<MessageEmbedOptions>;}): Promise<Message<T>>{
async editLast(newMessage: {content?: string; embeds?: Array<Embed>;}): Promise<Message<T>>{
if (!this._lastMessageID) throw new TypeError("Cannot edit last message if it does not exist.");
return this.client.rest.channels.editMessage<T>(
this.channelID,
Expand All @@ -444,7 +444,7 @@ export class Message<T extends AnyTextableChannel> extends Base<string> {
async editOriginal(
newMessage: {
content?: string;
embeds?: Array<MessageEmbedOptions>;
embeds?: Array<Embed>;
}
): Promise<Message<T>>{
if (!this.originals.responseID || this.isOriginal)
Expand Down
6 changes: 3 additions & 3 deletions lib/types/channels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface CreateMessageOptions {
* (min items 1; must have unique items true) */
hiddenLinkPreviewURLs?: Array<string>;
/** Embeds */
embeds?: Array<MessageEmbedOptions>;
embeds?: Array<Embed>;
/** Message IDs to reply to (min items 1; max items 5) */
replyMessageIDs?: Array<string>;
/** If set, this message will not notify any mentioned users or roles (default `false`) */
Expand All @@ -107,7 +107,7 @@ export interface EditMessageOptions {
* (min items 1; must have unique items true) */
hiddenLinkPreviewURLs?: Array<string>;
/** Embeds */
embeds?: Array<MessageEmbedOptions>;
embeds?: Array<Embed>;
// /** Message IDs to reply to (min items 1; max items 5) */
// replyMessageIds?: Array<string>;
// /** If set, this message will not notify any mentioned users or roles (default `false`) */
Expand All @@ -116,7 +116,7 @@ export interface EditMessageOptions {
// isPrivate?: boolean;
}

export interface MessageEmbedOptions {
export interface Embed {
/** Main header of the embed (max length 256) */
title?: string;
/** Subtext of the embed (max length 2048) */
Expand Down
4 changes: 2 additions & 2 deletions lib/types/webhooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Copyright (c) 2024 DinographicPixels. All rights reserved.
//

import { MessageEmbedOptions } from "./channels";
import { Embed } from "./channels";

export interface WebhookEditOptions {
/** New name of the webhook. */
Expand All @@ -24,7 +24,7 @@ export interface WebhookExecuteOptions {
content?: string;
username?: string;
avatarURL?: string;
embeds?: Array<MessageEmbedOptions>;
embeds?: Array<Embed>;
}

export interface WebhookMessageDetails {
Expand Down
6 changes: 3 additions & 3 deletions lib/util/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Member } from "../structures/Member";
import {
AnyChannel,
AnyTextableChannel,
MessageEmbedOptions,
Embed,
MessageConstructorParams,
RawUser,
RawMember,
Expand Down Expand Up @@ -42,7 +42,7 @@ export class Util {
this.#client = client;
}

embedsToParsed(embeds: Array<RawEmbed>): Array<MessageEmbedOptions> {
embedsToParsed(embeds: Array<RawEmbed>): Array<Embed> {
return embeds.map(embed => ({
author: embed.author === undefined ? undefined : {
name: embed.author.name,
Expand Down Expand Up @@ -70,7 +70,7 @@ export class Util {
url: embed.url
}));
}
embedsToRaw(embeds: Array<MessageEmbedOptions>): Array<RawEmbed> {
embedsToRaw(embeds: Array<Embed>): Array<RawEmbed> {
return embeds.map(embed => ({
author: embed.author === undefined ? undefined : {
name: embed.author.name,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "touchguild",
"version": "1.2.5",
"description": "TouchGuild is a NodeJS library for interfacing with Guilded.",
"description": "TouchGuild, a NodeJS library for interfacing with Guilded.",
"main": "./dist/lib/index.js",
"types": "./dist/lib/index.d.ts",
"module": "./dist/lib/index.mjs",
Expand Down

0 comments on commit ce4f6e4

Please sign in to comment.