@elara-services/tickets 4.4.1 → 4.5.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/.vscode/settings.json +8 -0
- package/lib/base.js +4 -2
- package/lib/html.js +1 -1
- package/lib/util.js +15 -3
- package/package.json +2 -2
package/lib/base.js
CHANGED
|
@@ -26,7 +26,10 @@ module.exports = class Tickets {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
this.options = options;
|
|
29
|
-
this.rest = new REST(
|
|
29
|
+
this.rest = new REST();
|
|
30
|
+
if ("setToken" in this.rest && options.client.token) {
|
|
31
|
+
this.rest.setToken(options.client.token);
|
|
32
|
+
}
|
|
30
33
|
if (options.suppressPatreon !== true) {
|
|
31
34
|
emitPackageMessage(`${name} - thanks`, () => {
|
|
32
35
|
log(`[${name}, v${version}]: Thanks for using the package!`, `Please support the packages via ${funding.map((c) => c.url).join(" OR ")}`);
|
|
@@ -311,7 +314,6 @@ module.exports = class Tickets {
|
|
|
311
314
|
if (!options) {
|
|
312
315
|
throw new Error(`No options provided`);
|
|
313
316
|
}
|
|
314
|
-
|
|
315
317
|
if (hasBit(options.flags, 1 << 15)) {
|
|
316
318
|
return await this.rest
|
|
317
319
|
.post(Routes.channelMessages(channelId), {
|
package/lib/html.js
CHANGED
|
@@ -27,7 +27,7 @@ exports.discordView = function (messages) {
|
|
|
27
27
|
document.getElementById("load").style.zIndex = -1
|
|
28
28
|
}
|
|
29
29
|
</script>
|
|
30
|
-
<script type="module" src="https://unpkg.com/@skyra/discord-components-core" async></script>
|
|
30
|
+
<script type="module" src="https://unpkg.com/@skyra/discord-components-core@2.8.0" async></script>
|
|
31
31
|
<style>
|
|
32
32
|
/* Preloader styles. */
|
|
33
33
|
#load {
|
package/lib/util.js
CHANGED
|
@@ -3,11 +3,12 @@ const {
|
|
|
3
3
|
Interactions: { modal },
|
|
4
4
|
} = require("@elara-services/packages"),
|
|
5
5
|
{ Collection, version } = require("discord.js"),
|
|
6
|
-
{ DiscordWebhook: Webhook,
|
|
6
|
+
{ DiscordWebhook: Webhook, handleFetch } = require("@elara-services/webhooks"),
|
|
7
7
|
defLang = require("../languages/en-US"),
|
|
8
8
|
pack = require("../package.json");
|
|
9
9
|
const { discordView } = require("./html");
|
|
10
|
-
const { make } = require("@elara-services/utils");
|
|
10
|
+
const { make, getClientIdFromToken } = require("@elara-services/utils");
|
|
11
|
+
const { REST } = require("@discordjs/rest");
|
|
11
12
|
|
|
12
13
|
exports.emojis = {
|
|
13
14
|
tickets: "1374908572982448208",
|
|
@@ -361,7 +362,18 @@ exports.getWebhookInfo = async (options, username = "Tickets") => {
|
|
|
361
362
|
if (options.webhook?.channelId) {
|
|
362
363
|
const channel = options.client.channels.resolve(options.webhook.channelId);
|
|
363
364
|
if (channel) {
|
|
364
|
-
|
|
365
|
+
let rest;
|
|
366
|
+
if ("setToken" in options.client.rest) {
|
|
367
|
+
rest = options.client.rest;
|
|
368
|
+
} else {
|
|
369
|
+
rest = new REST({
|
|
370
|
+
hashSweepInterval: 0,
|
|
371
|
+
handlerSweepInterval: 0,
|
|
372
|
+
|
|
373
|
+
});
|
|
374
|
+
rest.setToken(options.client.token);
|
|
375
|
+
}
|
|
376
|
+
const hook = await handleFetch(channel.isThread() ? channel.parentId : channel.id, getClientIdFromToken(options.client.token), rest);
|
|
365
377
|
if (hook) {
|
|
366
378
|
options.webhook.id = hook.id;
|
|
367
379
|
options.webhook.token = hook.token;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elara-services/tickets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Helper for tickets",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@discordjs/rest": "^2.5.0",
|
|
31
31
|
"@elara-services/packages": "^7.0.6",
|
|
32
32
|
"@elara-services/utils": "^3.0.7",
|
|
33
|
-
"@elara-services/webhooks": "^
|
|
33
|
+
"@elara-services/webhooks": "^5.0.0",
|
|
34
34
|
"discord-api-types": "^0.38.8"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|