mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
* Migrate beginner and minimal bot to discordeno v19
* Add .swcrc and fix minimal yarn.lock
* update .gitignore files
* Update nodejs template
Discordeno.js (DD v13) -> DD v19 "raw"
Currently the permission checking is not working correctly
* Fix permission issue
* Rename the templates
* remove unused indents
* Rename starter to beginner
So now it is minimal (main branch) -> beginner
* Really small refactor & eslint fixes (bigbot template)
This is to make my life less miserable at a later time
* mark rabbitMQ plugins as binary files
git seems to be treating them as text
* Add v19 bigbot rest
* Add gateway code
and rabbitmq_message_deduplication v0.6.2 plugin
* fix yarn messy semevr version for @types/amqplib
* clear channel con amqp connection close
* Add bot code for bigbot v19
missing prisma setup, collector setup & language setup
* Add localization
The "command versioning" system works the same say as before, but instead of a command version the code updates the commands every time they change based on the SHA1 of the commands
* Use file relative paths instead of cwd relative paths
* Fix todos
* revert autocomplete tests
* Revert "Add localization"
This reverts commit 2b1da8d2cd.
* move env assertion to config.ts
* Add shard ping to /ping
* fix small issue
* Update readme files
* use Date.now() for the bigbot REST ping
* Remove bigbot v16 code
* Add docker (compose) setup to bigbot template
* remove healthchecks from rest & gateway
* Update dependencies of examples
* Apply readme(s) suggestions from code review
Hopefully i haven't missed any related to markdown files
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Apply code suggestions from code review
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
---------
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
26 lines
939 B
TypeScript
26 lines
939 B
TypeScript
import { dirname } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
// This is a "polyfill" for the `Promise.withResolves`, while node 22 does support it, node 18 does not and this template does support node 18
|
|
export function promiseWithResolvers<T>(): PromiseWithResolvers<T> {
|
|
let resolve!: (data: T | PromiseLike<T>) => void
|
|
let reject!: (reason?: any) => void
|
|
const promise = new Promise<T>((_resolve, _reject) => {
|
|
resolve = _resolve
|
|
reject = _reject
|
|
})
|
|
|
|
return { promise, resolve, reject }
|
|
}
|
|
|
|
// This re-creates the `__dirname` that exists in CommonJS, in ESM node added `import.meta.dirname` but it is for node 20+, so we need this util to support node 18
|
|
export function getDirnameFromFileUrl(url: string): string {
|
|
return dirname(fileURLToPath(url))
|
|
}
|
|
|
|
export interface PromiseWithResolvers<T> {
|
|
promise: Promise<T>
|
|
resolve: (data: T | PromiseLike<T>) => void
|
|
reject: (reason?: any) => void
|
|
}
|