aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moulberry-bush
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r--src/commands/moulberry-bush/capePermissions.ts3
-rw-r--r--src/commands/moulberry-bush/capes.ts10
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts8
3 files changed, 7 insertions, 14 deletions
diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts
index 3ad9602..793ac59 100644
--- a/src/commands/moulberry-bush/capePermissions.ts
+++ b/src/commands/moulberry-bush/capePermissions.ts
@@ -11,7 +11,6 @@ import {
type SlashMessage
} from '#lib';
import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
-import got from 'got';
export default class CapePermissionsCommand extends BushCommand {
public constructor() {
@@ -50,7 +49,7 @@ export default class CapePermissionsCommand extends BushCommand {
}
try {
- capePerms = await got.get('http://moulberry.codes/permscapes.json').json();
+ capePerms = await fetch('http://moulberry.codes/permscapes.json').then((p) => (p.ok ? p.json() : null));
} catch (error) {
capePerms = null;
}
diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts
index 8693dba..6ffc540 100644
--- a/src/commands/moulberry-bush/capes.ts
+++ b/src/commands/moulberry-bush/capes.ts
@@ -14,11 +14,9 @@ import {
} from '#lib';
import assert from 'assert/strict';
import { ApplicationCommandOptionType, PermissionFlagsBits, type APIEmbed, type AutocompleteInteraction } from 'discord.js';
-import Fuse from 'fuse.js';
-import got from 'got';
+import { default as Fuse } from 'fuse.js';
assert(Fuse);
-assert(got);
export default class CapesCommand extends BushCommand {
public constructor() {
@@ -47,9 +45,9 @@ export default class CapesCommand extends BushCommand {
}
public override async exec(message: CommandMessage | SlashMessage, args: { cape: OptArgType<'string'> }) {
- const { tree: neuFileTree }: GithubTreeApi = await got
- .get('https://api.github.com/repos/NotEnoughUpdates/NotEnoughUpdates/git/trees/master?recursive=1')
- .json();
+ const { tree: neuFileTree }: GithubTreeApi = await fetch(
+ 'https://api.github.com/repos/NotEnoughUpdates/NotEnoughUpdates/git/trees/master?recursive=1'
+ ).then((p) => (p.ok ? p.json() : { tree: [] }));
const rawCapes = neuFileTree
.map((f) => ({
match: f.path.match(/src\/main\/resources\/assets\/notenoughupdates\/capes\/(?<name>\w+)_preview\.png/),
diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts
index 1237b3f..cde3f04 100644
--- a/src/commands/moulberry-bush/serverStatus.ts
+++ b/src/commands/moulberry-bush/serverStatus.ts
@@ -1,9 +1,5 @@
import { BushCommand, clientSendAndPermCheck, colors, emojis, type CommandMessage } from '#lib';
-import assert from 'assert/strict';
import { EmbedBuilder, PermissionFlagsBits } from 'discord.js';
-import got from 'got';
-
-assert(got);
export default class ServerStatusCommand extends BushCommand {
public constructor() {
@@ -28,8 +24,8 @@ export default class ServerStatusCommand extends BushCommand {
await message.util.reply({ embeds: [msgEmbed] });
let main;
try {
- await got.get('https://moulberry.codes/lowestbin.json').json();
- main = emojis.success;
+ const res = await fetch('https://moulberry.codes/lowestbin.json').then((p) => (p.ok ? p.json() : null));
+ main = res ? emojis.success : emojis.error;
} catch (e) {
main = emojis.error;
}