chore: move website and guide out of packages

This commit is contained in:
iCrawl
2022-10-10 01:22:48 +02:00
parent 0a9d57b011
commit 3ed668e539
175 changed files with 428 additions and 487 deletions

View File

@@ -0,0 +1,22 @@
export const PACKAGES = ['builders', 'collection', 'proxy', 'rest', 'util', 'voice', 'ws'];
export const DESCRIPTION =
"discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.";
export const CODE_EXAMPLE = `import { Client, GatewayIntentBits } from 'discord.js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.on('ready', () => {
console.log(\`Logged in as \${client.user.tag}!\`);
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
await client.login(TOKEN);`;

View File

@@ -0,0 +1,4 @@
export const fetcher = async (url: string) => {
const res = await fetch(url);
return res.json();
};

View File

@@ -0,0 +1,33 @@
import { findPackage, ApiNodeJSONEncoder } from '@discordjs/api-extractor-utils';
import type { ApiEntryPoint, ApiModel } from '@microsoft/api-extractor-model';
export function findMemberByKey(model: ApiModel, packageName: string, containerKey: string, version: string) {
const pkg = findPackage(model, packageName)!;
const member = (pkg.members[0] as ApiEntryPoint).tryGetMemberByKey(containerKey);
if (!member) {
return undefined;
}
return ApiNodeJSONEncoder.encode(model, member, version);
}
export function findMember(
model: ApiModel,
packageName: string,
memberName: string | undefined,
version: string,
): ReturnType<typeof ApiNodeJSONEncoder['encode']> | undefined {
if (!memberName) {
return undefined;
}
const pkg = findPackage(model, packageName)!;
const member = (pkg.members[0] as ApiEntryPoint).findMembersByName(memberName)[0];
if (!member) {
return undefined;
}
return ApiNodeJSONEncoder.encode(model, member, version);
}

View File

@@ -0,0 +1,6 @@
import MeiliSearch from 'meilisearch';
export const client = new MeiliSearch({
host: 'https://search.discordjs.dev',
apiKey: 'b51923c6abb574b1e97be9a03dc6414b6c69fb0c5696d0ef01a82b0f77d223db',
});