feat: create-discord-bot (#9420)

* feat: basic initialisation

* fix: no scope

* chore: add options for issues

* feat: good word, Monbrey

* feat: basic README.md

* fix: no documentation for this

* feat: install for them

* chore: update licencing

* chore: fix year

* fix: build tsup

* feat: add TypeScript option

* feat: add `name` option

* chore: ignore annoying errors

* chore: add tsconfig.json

* refactor: remove name

We can just use the name of the directory instead.

* chore: update cliff jumper rc

* chore: bump dependencies

* chore: bump dependencies

* fix: build in prepack

* fix: configure ESLint correctly

* feat: infer package manager

* docs(packageManager): document `install()`

* fix(packageManager): do not emit a warning for `npm`

* refactor: change project name colour to yellow

* docs(constants): basic documentation

* feat: add link

* chore: add `verbatimModuleSyntax`

* chore: bump discord.js

* refactor: switch to @sapphire/ts-config

* refactor: file name changes

* refactor: tweak description

* chore: update yarn.lock

* fix: add .env

* chore: bump dependencies

* feat: event handler

* refactor: use `default`

* refactor: simpler event

* chore: bump discord.js

* fix: add release script and reorder

* style: reorder package.json

* chore: remove unneeded ignores

* chore: bump minimum Node.js version

* chore: add @types/node to TypeScript package.json

* chore: apply requested changes

Co-authored-by: Noel <buechler.noel@outlook.com>

* style: run ESLint + Prettier

* refactor: prefer "the"

* refactor: remove some comments

* feat: add ESLint + Prettier

* chore: requested changes

Co-authored-by: Noel <buechler.noel@outlook.com>

* chore: more requested changes

Co-authored-by: Noel <buechler.noel@outlook.com>

---------

Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
Jiralite
2023-05-07 17:05:26 +01:00
committed by GitHub
parent 9ddb3ff71d
commit f83a8a58c9
42 changed files with 802 additions and 11 deletions

View File

@@ -0,0 +1,9 @@
import { Events } from 'discord.js';
export default {
name: Events.ClientReady,
once: true,
async execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`);
},
};

View File

@@ -0,0 +1,15 @@
import { readdir } from 'node:fs/promises';
import { join } from 'node:path';
import { fileURLToPath, URL } from 'node:url';
import { Client, GatewayIntentBits } from 'discord.js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const eventsPath = fileURLToPath(new URL('events', import.meta.url));
const eventFiles = await readdir(eventsPath).then((files) => files.filter((file) => file.endsWith('.js')));
for (const file of eventFiles) {
const event = (await import(join(eventsPath, file))).default;
client[event.data.once ? 'once' : 'on'](event.data.name, async (...args) => event.data.execute(...args));
}
void client.login();