Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"code_actions_on_format": {
"source.fixAll": true,
"source.organizeImports": true
},
"lsp": {
"vtsls": {
"settings": {
"javascript": {
"suggest": {
"completeJSDocs": true
}
},
"typescript": {
"suggest": {
"completeJSDocs": true
}
}
}
}
}
}
58 changes: 58 additions & 0 deletions src/commands/meta/contributors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { MessageFlags } from "discord.js";
import type { SubcommandCallbackOpts } from "../../types/command.ts";
import { buildComponents } from "../../utils/components/buildComponents.ts";

export default {
name: "contributors",
description: "List the people who contributed to the quillbot repository",
aliases: ["team", "collaborators"],
async callback({ message }: SubcommandCallbackOpts) {
// list contributors from GitHub API
const contributors = await fetch(
"https://api.github.com/repos/open-devhub/quillbot/contributors",
)
.then((res) => res.json())
.then((data) =>
data.map((contributor: { login: string }) => contributor.login),
)
.catch(() => "Unable to fetch contributors");

return message.reply({
flags: MessageFlags.IsComponentsV2,
components: buildComponents([
{
type: "container",
accentColor: 0x7289da,
components: [
{ type: "text", content: `### 💻 GitHub Contributors` },
{ type: "separator", spacing: "small" },
{
type: "text",
content:
contributors
.slice(0, 30)
.map((c: string) => `- [@${c}](https://github.com/${c})`)
.join("\n") +
(contributors.length > 30
? `\nand ${contributors.length - 30} more...`
: ""),
},
{ type: "separator", spacing: "small" },

{
type: "actionRow",
components: [
{
type: "button",
style: "link",
label: "View All Contributors",
url: "https://github.com/open-devhub/quillbot/contributors",
},
],
},
],
},
]),
});
},
};
38 changes: 7 additions & 31 deletions src/commands/meta/github.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { EmbedBuilder } from "discord.js";
import fetch from "node-fetch";
import type { SubcommandCallbackOpts } from "../../types/command.ts";
import type {
CommandCallbackOpts,
SubcommandCallbackOpts,
} from "../../types/command.ts";
import contributors from "./contributors.ts";

export default {
name: "github",
Expand All @@ -16,34 +18,8 @@ export default {
prs({ message }: SubcommandCallbackOpts) {
return message.reply("https://github.com/open-devhub/quillbot/pulls");
},
async contributors({ message }: SubcommandCallbackOpts) {
// list contributors from GitHub API
const contributors = await fetch(
"https://api.github.com/repos/open-devhub/quillbot/contributors",
)
.then((res) => res.json())
.then((data) =>
data.map((contributor: { login: string }) => contributor.login),
)
.catch(() => "Unable to fetch contributors");

return message.reply({
embeds: [
new EmbedBuilder()
.setTitle("💻 GitHub Contributors")
.setDescription(
contributors
.slice(0, 30)
.map((c: string) => `- [@${c}](https://github.com/${c})`)
.join("\n") +
(contributors.length > 30
? `\nand ${contributors.length - 30} more...`
: ""),
)
.setColor(0x7289da),
],
});
},
contributors: async ({ message }: SubcommandCallbackOpts) =>
contributors.callback({ message } as CommandCallbackOpts),
org({ message }: SubcommandCallbackOpts) {
return message.reply("https://github.com/open-devhub");
},
Expand Down
Loading