@skyhelperbot/utils 2.0.2-dev → 2.1.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/dist/classes/shardsUtil.d.ts +0 -1
- package/dist/classes/shardsUtil.js +0 -1
- package/package.json +1 -3
- package/dist/classes/UpdateEvent.d.ts +0 -30
- package/dist/classes/UpdateEvent.js +0 -52
- package/dist/classes/UpdateTs.d.ts +0 -35
- package/dist/classes/UpdateTs.js +0 -62
- package/dist/utils/buildTimesHTML.d.ts +0 -14
- package/dist/utils/buildTimesHTML.js +0 -208
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyhelperbot/utils",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Utilities for SkyHelper bot",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,13 +28,11 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@napi-rs/canvas": "^0.1.51",
|
|
30
30
|
"discord-api-types": "^0.37.93",
|
|
31
|
-
"moment-duration-format": "^2.3.2",
|
|
32
31
|
"typescript": "^5.4.3",
|
|
33
32
|
"undici": "^7.2.3"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"@types/luxon": "^3.4.2",
|
|
37
|
-
"@types/moment-duration-format": "^2.2.6",
|
|
38
36
|
"luxon": "^3.5.0",
|
|
39
37
|
"mongoose": "^8.3.2"
|
|
40
38
|
},
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { SpecialEventData } from "../typings.js";
|
|
2
|
-
/**
|
|
3
|
-
* @class
|
|
4
|
-
* @classdesc A class to update Events details in the client constructor
|
|
5
|
-
* @method update Updates the event details
|
|
6
|
-
*/
|
|
7
|
-
export declare class UpdateEvent {
|
|
8
|
-
readonly data: SpecialEventData;
|
|
9
|
-
constructor(data: SpecialEventData);
|
|
10
|
-
/**
|
|
11
|
-
* @param name Name of the event
|
|
12
|
-
*/
|
|
13
|
-
setName(name: string): this;
|
|
14
|
-
/**
|
|
15
|
-
* @param date Start date of the Event. Format DD-MM-YYYY
|
|
16
|
-
* @example
|
|
17
|
-
* new UpdateEvent().setDate('22-09-2023')
|
|
18
|
-
*/
|
|
19
|
-
setStart(date: string): this;
|
|
20
|
-
/**
|
|
21
|
-
* @param date End date of the Event. Format DD-MM-YYYY
|
|
22
|
-
* @example
|
|
23
|
-
* new UpdateEvent().setDate('22-09-2023')
|
|
24
|
-
*/
|
|
25
|
-
setEnd(date: string): this;
|
|
26
|
-
/**
|
|
27
|
-
* @returns The updated event
|
|
28
|
-
*/
|
|
29
|
-
update(): Promise<SpecialEventData>;
|
|
30
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import moment from "moment-timezone";
|
|
2
|
-
/**
|
|
3
|
-
* @class
|
|
4
|
-
* @classdesc A class to update Events details in the client constructor
|
|
5
|
-
* @method update Updates the event details
|
|
6
|
-
*/
|
|
7
|
-
export class UpdateEvent {
|
|
8
|
-
data;
|
|
9
|
-
constructor(data) {
|
|
10
|
-
this.data = data;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @param name Name of the event
|
|
14
|
-
*/
|
|
15
|
-
setName(name) {
|
|
16
|
-
if (!name || typeof name !== "string") {
|
|
17
|
-
throw new TypeError("Name must be a non-empty string.");
|
|
18
|
-
}
|
|
19
|
-
this.data.name = name;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @param date Start date of the Event. Format DD-MM-YYYY
|
|
24
|
-
* @example
|
|
25
|
-
* new UpdateEvent().setDate('22-09-2023')
|
|
26
|
-
*/
|
|
27
|
-
setStart(date) {
|
|
28
|
-
if (!date || typeof date !== "string") {
|
|
29
|
-
throw new TypeError("Date must be a non-empty string.");
|
|
30
|
-
}
|
|
31
|
-
this.data.startDate = date;
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @param date End date of the Event. Format DD-MM-YYYY
|
|
36
|
-
* @example
|
|
37
|
-
* new UpdateEvent().setDate('22-09-2023')
|
|
38
|
-
*/
|
|
39
|
-
setEnd(date) {
|
|
40
|
-
if (!date || typeof date !== "string") {
|
|
41
|
-
throw new TypeError("Date must be a non-empty string.");
|
|
42
|
-
}
|
|
43
|
-
this.data.endDate = date;
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @returns The updated event
|
|
48
|
-
*/
|
|
49
|
-
async update() {
|
|
50
|
-
return await this.data.save();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { TSData } from "../typings.js";
|
|
2
|
-
/**
|
|
3
|
-
* @class
|
|
4
|
-
* @classdesc A class to update traveling spirit details in the client constructor
|
|
5
|
-
* @method update updates the ts details
|
|
6
|
-
* @returns {Object}
|
|
7
|
-
*/
|
|
8
|
-
export declare class UpdateTS {
|
|
9
|
-
readonly data: TSData;
|
|
10
|
-
constructor(data: TSData);
|
|
11
|
-
/**
|
|
12
|
-
* Sets the name of the TS
|
|
13
|
-
* @param name Name of the returning TS
|
|
14
|
-
*/
|
|
15
|
-
setName(name: string): this;
|
|
16
|
-
/**
|
|
17
|
-
* Sets the visit date of the ts
|
|
18
|
-
* @param date Returnig date. Format: DD-MM-YYYY
|
|
19
|
-
*/
|
|
20
|
-
setVisit(date: string): this;
|
|
21
|
-
/**
|
|
22
|
-
* Sets the value of the t spirit
|
|
23
|
-
* @param value The value of the spirit in the spiritsData
|
|
24
|
-
*/
|
|
25
|
-
setValue(value: string): this;
|
|
26
|
-
/**
|
|
27
|
-
* Sets the index of the returning ts
|
|
28
|
-
* @param index The returning index of the TS
|
|
29
|
-
*/
|
|
30
|
-
setIndex(index: number): this;
|
|
31
|
-
/**
|
|
32
|
-
* returns the updated ts details
|
|
33
|
-
*/
|
|
34
|
-
update(): Promise<TSData>;
|
|
35
|
-
}
|
package/dist/classes/UpdateTs.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class
|
|
3
|
-
* @classdesc A class to update traveling spirit details in the client constructor
|
|
4
|
-
* @method update updates the ts details
|
|
5
|
-
* @returns {Object}
|
|
6
|
-
*/
|
|
7
|
-
export class UpdateTS {
|
|
8
|
-
data;
|
|
9
|
-
constructor(data) {
|
|
10
|
-
this.data = data;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Sets the name of the TS
|
|
14
|
-
* @param name Name of the returning TS
|
|
15
|
-
*/
|
|
16
|
-
setName(name) {
|
|
17
|
-
if (!name || typeof name !== "string") {
|
|
18
|
-
throw new TypeError("Name must be a non-empty string.");
|
|
19
|
-
}
|
|
20
|
-
this.data.name = name;
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Sets the visit date of the ts
|
|
25
|
-
* @param date Returnig date. Format: DD-MM-YYYY
|
|
26
|
-
*/
|
|
27
|
-
setVisit(date) {
|
|
28
|
-
if (!date || typeof date !== "string") {
|
|
29
|
-
throw new TypeError("Date must be a non-empty string.");
|
|
30
|
-
}
|
|
31
|
-
this.data.visitDate = date;
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets the value of the t spirit
|
|
36
|
-
* @param value The value of the spirit in the spiritsData
|
|
37
|
-
*/
|
|
38
|
-
setValue(value) {
|
|
39
|
-
if (!value || typeof value !== "string") {
|
|
40
|
-
throw new TypeError("Value must be a non-empty string.");
|
|
41
|
-
}
|
|
42
|
-
this.data.value = value;
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Sets the index of the returning ts
|
|
47
|
-
* @param index The returning index of the TS
|
|
48
|
-
*/
|
|
49
|
-
setIndex(index) {
|
|
50
|
-
if (!index || typeof index !== "number") {
|
|
51
|
-
throw new TypeError("Index must be a number.");
|
|
52
|
-
}
|
|
53
|
-
this.data.index = index;
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* returns the updated ts details
|
|
58
|
-
*/
|
|
59
|
-
async update() {
|
|
60
|
-
return await this.data.save();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ChatInputCommandInteraction } from "discord.js";
|
|
2
|
-
export interface Field {
|
|
3
|
-
name: string;
|
|
4
|
-
example: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Dynamically builds a timestamp sweb page html with the given data
|
|
9
|
-
* @param interaction The interaction that intiated this
|
|
10
|
-
* @param fieldsData The data about times
|
|
11
|
-
* @param offset Offset of the timezone
|
|
12
|
-
* @param providedTime
|
|
13
|
-
*/
|
|
14
|
-
export declare const buildTimesHTML: (interaction: ChatInputCommandInteraction, fieldsData: Field[], offset: string, providedTime: string) => string;
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import {} from "discord.js";
|
|
2
|
-
/**
|
|
3
|
-
* Dynamically builds a timestamp sweb page html with the given data
|
|
4
|
-
* @param interaction The interaction that intiated this
|
|
5
|
-
* @param fieldsData The data about times
|
|
6
|
-
* @param offset Offset of the timezone
|
|
7
|
-
* @param providedTime
|
|
8
|
-
*/
|
|
9
|
-
export const buildTimesHTML = (interaction, fieldsData, offset, providedTime) => {
|
|
10
|
-
return `
|
|
11
|
-
<!DOCTYPE html>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<html lang="en">
|
|
15
|
-
|
|
16
|
-
<head>
|
|
17
|
-
<meta charset="UTF-8">
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
<!--=============== FAVICON ===============-->
|
|
20
|
-
<link rel="shortcut icon" href="/assets/img/boticon.png" type="image/x-icon">
|
|
21
|
-
|
|
22
|
-
<!--=============== BOXICONS ===============-->
|
|
23
|
-
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
|
|
24
|
-
|
|
25
|
-
<!--=============== SWIPER CSS ===============-->
|
|
26
|
-
<link rel="stylesheet" href="/assets/css/swiper-bundle.min.css">
|
|
27
|
-
|
|
28
|
-
<!--=============== CSS ===============-->
|
|
29
|
-
<link rel="stylesheet" href="/assets/css/styles.css">
|
|
30
|
-
|
|
31
|
-
<title>Timestamp - SkyHelper</title>
|
|
32
|
-
</head>
|
|
33
|
-
<body>
|
|
34
|
-
<!--==================== HEADER ====================-->
|
|
35
|
-
|
|
36
|
-
<header class="header" id="header">
|
|
37
|
-
|
|
38
|
-
<nav class="nav container">
|
|
39
|
-
<a href="/" class="nav__logo">
|
|
40
|
-
<img src="/assets/img/boticon.png" style="top: 50px; left: 50px; widht: 40px; height: 40px;"> <p class="nav__logo-text">SkyHelper</p>
|
|
41
|
-
</a>
|
|
42
|
-
<a href="/" class="nav__link">
|
|
43
|
-
|
|
44
|
-
<i class='bx bx-home-alt-2'></i>
|
|
45
|
-
<span>Home</span>
|
|
46
|
-
</a>
|
|
47
|
-
|
|
48
|
-
<!-- Theme change button -->
|
|
49
|
-
<i class='bx bx-moon change-theme' id="theme-button"></i>
|
|
50
|
-
<a href="/commands" class="nav__link">
|
|
51
|
-
<i class='bx bx-code-alt com-icon'></i><p class="nav__com">Commands</p>
|
|
52
|
-
</a>
|
|
53
|
-
<a href="https://discord.com/invite/u9zUjWbbQ4" class="button nav__button">
|
|
54
|
-
Invite Me
|
|
55
|
-
</a>
|
|
56
|
-
</nav>
|
|
57
|
-
</header>
|
|
58
|
-
|
|
59
|
-
<!-- Content -->
|
|
60
|
-
<main class="main">
|
|
61
|
-
<section class="home section" id="home">
|
|
62
|
-
<div class="home__container container grid">
|
|
63
|
-
<div class="home__data">
|
|
64
|
-
<h1 class="home__title">
|
|
65
|
-
Timestamp
|
|
66
|
-
</h1>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</section>
|
|
70
|
-
|
|
71
|
-
</main>
|
|
72
|
-
|
|
73
|
-
<!-- timestamp -->
|
|
74
|
-
<section class="value section" id="value">
|
|
75
|
-
<div class="value__container container times__data">
|
|
76
|
-
<h2 class="section__title">
|
|
77
|
-
Timestamp for <img src="${interaction.user.displayAvatarURL()}" style="width:25px;height:25px;border-radius:50%;"><span> ${interaction.user.username}</span>
|
|
78
|
-
</h2>
|
|
79
|
-
<div class="alert alert-info">Provided Time: ${providedTime}<br>Offset: <strong>${offset}</strong>
|
|
80
|
-
</div>
|
|
81
|
-
<div class="value__accordion-item2">
|
|
82
|
-
${fieldsData
|
|
83
|
-
.map((field) => `
|
|
84
|
-
|
|
85
|
-
<div class="time__header">
|
|
86
|
-
<strong>${field.name} (<span class="discUnix">${field.example}</span>)</strong></div>
|
|
87
|
-
|
|
88
|
-
<br> <span class="code-block">${sanitizeField(field.value)}</span> <button class="copyBtn">
|
|
89
|
-
<span><svg class ="copySvg" viewBox="0 0 467 512.22" clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" xmlns="http://www.w3.org/2000/svg" height="12" width="12"><path d="M131.07 372.11c.37 1 .57 2.08.57 3.2 0 1.13-.2 2.21-.57 3.21v75.91c0 10.74 4.41 20.53 11.5 27.62s16.87 11.49 27.62 11.49h239.02c10.75 0 20.53-4.4 27.62-11.49s11.49-16.88 11.49-27.62V152.42c0-10.55-4.21-20.15-11.02-27.18l-.47-.43c-7.09-7.09-16.87-11.5-27.62-11.5H170.19c-10.75 0-20.53 4.41-27.62 11.5s-11.5 16.87-11.5 27.61v219.69zm-18.67 12.54H57.23c-15.82 0-30.1-6.58-40.45-17.11C6.41 356.97 0 342.4 0 326.52V57.79c0-15.86 6.5-30.3 16.97-40.78l.04-.04C27.51 6.49 41.94 0 57.79 0h243.63c15.87 0 30.3 6.51 40.77 16.98l.03.03c10.48 10.48 16.99 24.93 16.99 40.78v36.85h50c15.9 0 30.36 6.5 40.82 16.96l.54.58c10.15 10.44 16.43 24.66 16.43 40.24v302.01c0 15.9-6.5 30.36-16.96 40.82-10.47 10.47-24.93 16.97-40.83 16.97H170.19c-15.9 0-30.35-6.5-40.82-16.97-10.47-10.46-16.97-24.92-16.97-40.82v-69.78zM340.54 94.64V57.79c0-10.74-4.41-20.53-11.5-27.63-7.09-7.08-16.86-11.48-27.62-11.48H57.79c-10.78 0-20.56 4.38-27.62 11.45l-.04.04c-7.06 7.06-11.45 16.84-11.45 27.62v268.73c0 10.86 4.34 20.79 11.38 27.97 6.95 7.07 16.54 11.49 27.17 11.49h55.17V152.42c0-15.9 6.5-30.35 16.97-40.82 10.47-10.47 24.92-16.96 40.82-16.96h170.35z" fill-rule="nonzero"></path></svg> Copy</span>
|
|
90
|
-
<span>Copied</span>
|
|
91
|
-
</button>
|
|
92
|
-
<br><br>`)
|
|
93
|
-
.join("")}
|
|
94
|
-
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</section>
|
|
98
|
-
<!--==================== FOOTER ====================-->
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<footer class="footer section">
|
|
103
|
-
|
|
104
|
-
<div class="footer__container container grid">
|
|
105
|
-
<div>
|
|
106
|
-
<a href="#" class="footer__logo">
|
|
107
|
-
<img src="/assets/img/boticon.png" style="top: 50px; left: 50px; widht: 20px; height: 20px;"> SkyHelper
|
|
108
|
-
</a>
|
|
109
|
-
<p class="footer__description">
|
|
110
|
-
A discord bot for the game Sky: Children of the Light
|
|
111
|
-
</p>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="footer__content">
|
|
114
|
-
<div>
|
|
115
|
-
<h3 class="footer__title">
|
|
116
|
-
About
|
|
117
|
-
</h3>
|
|
118
|
-
<ul class="footer__links">
|
|
119
|
-
<li>
|
|
120
|
-
<a href="/" class="footer__link">About Me</a>
|
|
121
|
-
</li>
|
|
122
|
-
|
|
123
|
-
<li>
|
|
124
|
-
|
|
125
|
-
<a href="/#popular" class="footer__link">Features</a>
|
|
126
|
-
|
|
127
|
-
</li>
|
|
128
|
-
<li>
|
|
129
|
-
|
|
130
|
-
<a href="https://docs.skyhelper.xyz" class="footer__link">Documentation</a>
|
|
131
|
-
|
|
132
|
-
</li>
|
|
133
|
-
</ul>
|
|
134
|
-
</div>
|
|
135
|
-
<div>
|
|
136
|
-
|
|
137
|
-
<h3 class="footer__title">
|
|
138
|
-
|
|
139
|
-
Support
|
|
140
|
-
</h3>
|
|
141
|
-
<ul class="footer__links">
|
|
142
|
-
<li>
|
|
143
|
-
<a href="/#value" class="footer__link">FAQs</a>
|
|
144
|
-
</li>
|
|
145
|
-
<li>
|
|
146
|
-
|
|
147
|
-
<a href="https://discord.com/invite/u9zUjWbbQ4" class="footer__link">Support Server</a>
|
|
148
|
-
|
|
149
|
-
</li>
|
|
150
|
-
<li>
|
|
151
|
-
|
|
152
|
-
<a href="/contact-us" class="footer__link">Contact Us</a>
|
|
153
|
-
|
|
154
|
-
</li>
|
|
155
|
-
</ul>
|
|
156
|
-
</div>
|
|
157
|
-
<div>
|
|
158
|
-
|
|
159
|
-
<h3 class="footer__title">
|
|
160
|
-
|
|
161
|
-
Socials
|
|
162
|
-
</h3>
|
|
163
|
-
<ul class="footer__social">
|
|
164
|
-
<a href="https://github.com/imnaiyar/SkyHelper" target="_blank" class="footer__social-link">
|
|
165
|
-
<i class='bx bxl-github'></i>
|
|
166
|
-
</a>
|
|
167
|
-
<a href="https://discord.com/invite/u9zUjWbbQ4" target="_blank" class="footer__social-link">
|
|
168
|
-
<i class='bx bxl-discord' ></i>
|
|
169
|
-
</a>
|
|
170
|
-
</ul>
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<div class="footer__info container">
|
|
176
|
-
<span class="footer__copy">
|
|
177
|
-
© SkyHelper. All rights reserved
|
|
178
|
-
</span>
|
|
179
|
-
|
|
180
|
-
<div class="footer__privacy">
|
|
181
|
-
<a href="/tos">Terms of Service</a>
|
|
182
|
-
<a href="/privacy">Privacy Policy</a>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</footer>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<!--========== SCROLL UP ==========-->
|
|
189
|
-
<a href="#" class="scrollup" id="scroll-up">
|
|
190
|
-
<i class='bx bx-chevrons-up' ></i>
|
|
191
|
-
</a>
|
|
192
|
-
|
|
193
|
-
<!--=============== SCROLLREVEAL ===============-->
|
|
194
|
-
<script src="/assets/js/scrollreveal.min.js"></script>
|
|
195
|
-
|
|
196
|
-
<!--=============== SWIPER JS ===============-->
|
|
197
|
-
<script src="/assets/js/swiper-bundle.min.js"></script>
|
|
198
|
-
|
|
199
|
-
<!--=============== MAIN JS ===============-->
|
|
200
|
-
<script src="/assets/js/main.js"></script>
|
|
201
|
-
</body>
|
|
202
|
-
</html>
|
|
203
|
-
`;
|
|
204
|
-
};
|
|
205
|
-
function sanitizeField(value) {
|
|
206
|
-
// Remove backticks, <, and > characters
|
|
207
|
-
return value.replace(/`/g, "").replace(/</g, "<").replace(/>/g, ">");
|
|
208
|
-
}
|