@hyunsdev/discord-webhook
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@hyunsdev/discord-webhook

@hyunsdev/discord-webhook

디스코드 웹훅 라이브러리

GPLv3 License Language


개요

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

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;
    }[];
}

Readme

Keywords

none

Package Sidebar

Install

npm i @hyunsdev/discord-webhook

Weekly Downloads

5

Version

1.0.2

License

GPL-3.0

Unpacked Size

18.3 kB

Total Files

29

Last publish

Collaborators

  • phw3071