@betternotify/discord 0.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.js +2553 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Better-Notify contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as _betternotify_core0 from "@betternotify/core";
|
|
2
|
+
import { LoggerLike, Transport as Transport$1 } from "@betternotify/core";
|
|
3
|
+
import { HttpClientBehaviorOptions, MockTransport } from "@betternotify/core/transports";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
type DiscordEmbedFooter = {
|
|
7
|
+
text: string;
|
|
8
|
+
icon_url?: string;
|
|
9
|
+
};
|
|
10
|
+
type DiscordEmbedImage = {
|
|
11
|
+
url: string;
|
|
12
|
+
};
|
|
13
|
+
type DiscordEmbedAuthor = {
|
|
14
|
+
name: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
icon_url?: string;
|
|
17
|
+
};
|
|
18
|
+
type DiscordEmbedField = {
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
inline?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type DiscordEmbed = {
|
|
24
|
+
title?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
url?: string;
|
|
27
|
+
color?: number;
|
|
28
|
+
timestamp?: string;
|
|
29
|
+
footer?: DiscordEmbedFooter;
|
|
30
|
+
image?: DiscordEmbedImage;
|
|
31
|
+
thumbnail?: DiscordEmbedImage;
|
|
32
|
+
author?: DiscordEmbedAuthor;
|
|
33
|
+
fields?: DiscordEmbedField[];
|
|
34
|
+
};
|
|
35
|
+
type DiscordSendArgs<TInput = unknown> = {
|
|
36
|
+
input: TInput;
|
|
37
|
+
};
|
|
38
|
+
type DiscordAttachment = {
|
|
39
|
+
filename: string;
|
|
40
|
+
content: Buffer | string;
|
|
41
|
+
contentType?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
};
|
|
44
|
+
type RenderedDiscord = {
|
|
45
|
+
body: string;
|
|
46
|
+
embeds?: DiscordEmbed[];
|
|
47
|
+
username?: string;
|
|
48
|
+
avatarUrl?: string;
|
|
49
|
+
attachments?: DiscordAttachment[];
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/channel.d.ts
|
|
53
|
+
type BodyResolver<TInput> = string | ((args: {
|
|
54
|
+
input: TInput;
|
|
55
|
+
ctx: unknown;
|
|
56
|
+
}) => string);
|
|
57
|
+
type EmbedsResolver<TInput> = DiscordEmbed[] | ((args: {
|
|
58
|
+
input: TInput;
|
|
59
|
+
ctx: unknown;
|
|
60
|
+
}) => DiscordEmbed[]);
|
|
61
|
+
declare const discordChannel: () => _betternotify_core0.Channel<"discord", _betternotify_core0.ChannelBuilder<unknown, {
|
|
62
|
+
body: string;
|
|
63
|
+
embeds: DiscordEmbed[];
|
|
64
|
+
username: string;
|
|
65
|
+
avatarUrl: string;
|
|
66
|
+
attachments: DiscordAttachment[];
|
|
67
|
+
}, {
|
|
68
|
+
body: _betternotify_core0.SlotConfig<"resolver"> & {
|
|
69
|
+
required: true;
|
|
70
|
+
__value?: string | undefined;
|
|
71
|
+
optional: () => _betternotify_core0.SlotConfig<"resolver"> & {
|
|
72
|
+
required: false;
|
|
73
|
+
__value?: string | undefined;
|
|
74
|
+
optional: /*elided*/any;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
embeds: _betternotify_core0.SlotConfig<"resolver"> & {
|
|
78
|
+
required: false;
|
|
79
|
+
__value?: DiscordEmbed[] | undefined;
|
|
80
|
+
optional: () => _betternotify_core0.SlotConfig<"resolver"> & /*elided*/any;
|
|
81
|
+
};
|
|
82
|
+
username: _betternotify_core0.SlotConfig<"resolver"> & {
|
|
83
|
+
required: false;
|
|
84
|
+
__value?: string | undefined;
|
|
85
|
+
optional: () => _betternotify_core0.SlotConfig<"resolver"> & /*elided*/any;
|
|
86
|
+
};
|
|
87
|
+
avatarUrl: _betternotify_core0.SlotConfig<"resolver"> & {
|
|
88
|
+
required: false;
|
|
89
|
+
__value?: string | undefined;
|
|
90
|
+
optional: () => _betternotify_core0.SlotConfig<"resolver"> & /*elided*/any;
|
|
91
|
+
};
|
|
92
|
+
attachments: _betternotify_core0.SlotConfig<"resolver"> & {
|
|
93
|
+
required: false;
|
|
94
|
+
__value?: DiscordAttachment[] | undefined;
|
|
95
|
+
optional: () => _betternotify_core0.SlotConfig<"resolver"> & /*elided*/any;
|
|
96
|
+
};
|
|
97
|
+
}, Omit<{
|
|
98
|
+
input: unknown;
|
|
99
|
+
}, "input">, RenderedDiscord>, {
|
|
100
|
+
input: unknown;
|
|
101
|
+
}, RenderedDiscord, _betternotify_core0.Transport<RenderedDiscord, unknown>>;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/transports/types.d.ts
|
|
104
|
+
type DiscordTransportData = {
|
|
105
|
+
transportMessageId?: string;
|
|
106
|
+
raw: unknown;
|
|
107
|
+
};
|
|
108
|
+
type Transport = Transport$1<RenderedDiscord, DiscordTransportData>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/transports/mock.d.ts
|
|
111
|
+
type MockDiscordTransport = MockTransport<RenderedDiscord, DiscordTransportData> & {
|
|
112
|
+
readonly messages: ReadonlyArray<RenderedDiscord & {
|
|
113
|
+
id: string;
|
|
114
|
+
}>;
|
|
115
|
+
};
|
|
116
|
+
declare const mockDiscordTransport: () => MockDiscordTransport;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/transports/discord.types.d.ts
|
|
119
|
+
type DiscordTransportOptions = {
|
|
120
|
+
webhookUrl: string;
|
|
121
|
+
username?: string;
|
|
122
|
+
avatarUrl?: string;
|
|
123
|
+
wait?: boolean;
|
|
124
|
+
logger?: LoggerLike;
|
|
125
|
+
http?: HttpClientBehaviorOptions;
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/transports/discord.d.ts
|
|
129
|
+
declare const discordTransport: (opts: DiscordTransportOptions) => Transport;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/is-retriable.d.ts
|
|
132
|
+
declare const isDiscordRetriable: (err: unknown) => boolean;
|
|
133
|
+
//#endregion
|
|
134
|
+
export { type BodyResolver, type DiscordAttachment, type DiscordEmbed, type DiscordEmbedAuthor, type DiscordEmbedField, type DiscordEmbedFooter, type DiscordEmbedImage, type DiscordSendArgs, type DiscordTransportData, type DiscordTransportOptions, type EmbedsResolver, type MockDiscordTransport, type RenderedDiscord, type Transport, discordChannel, discordTransport, isDiscordRetriable, mockDiscordTransport };
|