Skip to content

Commit fc07da6

Browse files
committed
chore: update deps
1 parent 702dbfa commit fc07da6

6 files changed

Lines changed: 95 additions & 6 deletions

File tree

deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ export {
77
export * from "https://deno.land/x/discordeno@13.0.0-rc45/mod.ts";
88
export * from "https://deno.land/x/discordeno@13.0.0-rc45/plugins/mod.ts";
99
export { config as dotEnvConfig } from "https://deno.land/x/dotenv@v3.1.0/mod.ts";
10-
export * from "https://esm.sh/typedoc-json-parser@3.0.0";
10+
export * from "https://esm.sh/typedoc-json-parser@5.0.0";

src/commands/class.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ createCommand({
9090
"Source",
9191
"Link",
9292
cls.source?.url || "https://josh.evie.dev",
93+
).addButton(
94+
"Website",
95+
"Link",
96+
`https://joshdocs.netlify.app/docs/${
97+
cls.project.name.split("/")[1]
98+
}/classes#${cls.name}`,
9399
),
94100
},
95101
},

src/commands/eval.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { BOT_COLOR } from "../../config.ts";
2+
import {
3+
ApplicationCommandOptionTypes,
4+
ApplicationCommandTypes,
5+
InteractionResponseTypes,
6+
} from "../../deps.ts";
7+
import * as docsUtils from "../utils/docs.ts";
8+
import { Embeds } from "../utils/embed.ts";
9+
import { createCommand } from "./mod.ts";
10+
11+
const docs = docsUtils;
12+
13+
createCommand({
14+
name: "eval",
15+
description: "Evaluate code",
16+
type: ApplicationCommandTypes.ChatInput,
17+
scope: "Global",
18+
options: [
19+
{
20+
name: "code",
21+
description: "Code",
22+
type: ApplicationCommandOptionTypes.String,
23+
required: true,
24+
},
25+
],
26+
execute: async (bot, interaction) => {
27+
if (interaction.user.id !== 709674034798788617n) {
28+
return bot.helpers.sendInteractionResponse(
29+
interaction.id,
30+
interaction.token,
31+
{
32+
type: InteractionResponseTypes.ChannelMessageWithSource,
33+
data: {
34+
flags: 1 << 6,
35+
content: "Sorry, you are not allowed to use this command",
36+
},
37+
},
38+
);
39+
}
40+
const inputCode = interaction.data?.options?.find(
41+
(x) => x.name === "code",
42+
)?.value as string;
43+
try {
44+
docs; // to be used
45+
let result = eval(inputCode);
46+
if (result instanceof Promise) {
47+
result = await result;
48+
}
49+
const embed = new Embeds(bot)
50+
.setTitle("Eval")
51+
.setColor(BOT_COLOR)
52+
.addField("Output", `\`\`\`ts\n${Deno.inspect(result)}\`\`\``);
53+
return bot.helpers.sendInteractionResponse(
54+
interaction.id,
55+
interaction.token,
56+
{
57+
type: InteractionResponseTypes.ChannelMessageWithSource,
58+
data: {
59+
embeds: embed,
60+
},
61+
},
62+
);
63+
} catch (error) {
64+
const embed = new Embeds(bot)
65+
.setTitle("Eval")
66+
.setColor(BOT_COLOR)
67+
.addField("Output", `\`\`\`ts\n${error}\`\`\``);
68+
return bot.helpers.sendInteractionResponse(
69+
interaction.id,
70+
interaction.token,
71+
{
72+
type: InteractionResponseTypes.ChannelMessageWithSource,
73+
data: {
74+
embeds: embed,
75+
},
76+
},
77+
);
78+
}
79+
},
80+
});

src/commands/method.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ createCommand({
9191
"Source",
9292
"Link",
9393
method.source?.url || "https://josh.evie.dev",
94+
).addButton(
95+
"Website",
96+
"Link",
97+
`https://joshdocs.netlify.app/docs/${
98+
method.project.name.split("/")[1]
99+
}/methods#${method.parent.name}-${method.name}`,
94100
),
95101
},
96102
},

src/utils/docs.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ export const resolveReferenceType = (type: ReferenceTypeParser) => {
4040
};
4141

4242
export const resolveType = (type: TypeParser) => {
43-
if (type instanceof ReferenceTypeParser) {
44-
return resolveReferenceType(type);
45-
}
46-
47-
return type.toString();
43+
return `[${type.toString()}](https://joshdocs.netlify.app/)`;
4844
};
4945

5046
let filesCache: { date?: Date; files: File[] };

src/utils/notFound.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const notFound = async (
5454
{
5555
type: InteractionResponseTypes.ChannelMessageWithSource,
5656
data: {
57+
flags: 1 << 6,
5758
embeds: new Embeds(bot)
5859
.setTitle(name + " not found")
5960
.setColor(BOT_COLOR)

0 commit comments

Comments
 (0)