1.0.2 • Published 2 years ago

@hyunsdev/discord-webhook v1.0.2

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
2 years ago

개요

디스코드 웹훅을 보다 편리하게 사용할 수 있는 라이브러리입니다.

Install

npm install @hyunsdev/discord-webhook
yarn add @hyunsdev/discord-webhook

Usage

import { Webhook, Embed } from '@hyunsdev/discord-webhook';

(async () => {
    const client = new Webhook('your-webhook-url', 'userName', 'avatarUrl');

    // Send Message
    await client.send('Message');

    // Send Embeds
    const embed = new Embed({
        title: 'Title',
        description: 'This is an embed.',
    });

    await client.send('', [embed]);
})();

Embed Type

아래 내용은 쉬운 이해를 위해 임의로 코드를 변형한 내용입니다. 정확한 정의는 src/Embed.ts 를 확인해주세요.

import { APIEmbed } from 'discord-api-types/v10';

class Embed implements APIEmbed {
    title?: string;
    description?: string;
    url?: string;
    timestamp?: string;
    color?: number;
    footer?: {
        text: string;
        icon_url?: string;
        proxy_icon_url?: string;
    };
    image?: {
        url: string;
        proxy_url?: string;
        height?: number;
        width?: number;
    };
    thumbnail?: {
        url: string;
        proxy_url?: string;
        height?: number;
        width?: number;
    };
    provider?: {
        name?: string;
        url?: string;
    };
    author?: {
        name: string;
        url?: string;
        icon_url?: string;
        proxy_icon_url?: string;
    };
    fields?: {
        name: string;
        value: string;
        inline?: string;
    }[];
}
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago