mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
Fully renamed to unicord
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<h2>discord.ts</h2>
|
<img src="./assets/unicord.png" alt="unicord" width="200"/>
|
||||||
|
<h2>unicord</h2>
|
||||||
<p><em>Build good bots fast</em></p>
|
<p><em>Build good bots fast</em></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -14,16 +15,16 @@ It's typecript first and has some nifty features like hydration and argument typ
|
|||||||
Install with your package manager of choice.
|
Install with your package manager of choice.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install discord.ts
|
npm install unicord
|
||||||
yarn add discord.ts
|
yarn add unicord
|
||||||
bun add discord.ts
|
bun add unicord
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
A small example implementation.
|
A small example implementation.
|
||||||
```typescript
|
```typescript
|
||||||
import { Client, type Context } from '`discord.ts';
|
import { Client, type Context } from 'unicord';
|
||||||
|
|
||||||
// Initialize and configure
|
// Initialize and configure
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
@@ -57,7 +58,7 @@ client.connect();
|
|||||||
This library is designed to be type safe and resolve types for you. Because of this you can write code that is both safe and easy to understand. With the `createCommandHandler` utility you can provide types for command arguments. The client will then check and resolve them for you.
|
This library is designed to be type safe and resolve types for you. Because of this you can write code that is both safe and easy to understand. With the `createCommandHandler` utility you can provide types for command arguments. The client will then check and resolve them for you.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { createCommandHandler, CommandOptionType, type Context } from 'discord.ts';
|
import { createCommandHandler, CommandOptionType, type Context } from 'unicord';
|
||||||
|
|
||||||
// <...>
|
// <...>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1012 KiB |
@@ -109,8 +109,8 @@ export class Gateway {
|
|||||||
intents: this.client.intents.reduce((acc, intent) => acc | intent, 0),
|
intents: this.client.intents.reduce((acc, intent) => acc | intent, 0),
|
||||||
properties: {
|
properties: {
|
||||||
os: process.platform,
|
os: process.platform,
|
||||||
browser: 'discord.ts',
|
browser: 'unicord',
|
||||||
device: 'discord.ts'
|
device: 'unicord'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -2,11 +2,11 @@ export const isNil = (value: any): value is null | undefined => value === null |
|
|||||||
export const exists = <T>(value: T | null | undefined): value is NonNullable<T> => !isNil(value);
|
export const exists = <T>(value: T | null | undefined): value is NonNullable<T> => !isNil(value);
|
||||||
export const isObject = (value: any): value is Record<string, any> => typeof value === 'object' && !Array.isArray(value);
|
export const isObject = (value: any): value is Record<string, any> => typeof value === 'object' && !Array.isArray(value);
|
||||||
export const log = (...args: any[]) => {
|
export const log = (...args: any[]) => {
|
||||||
const LOG_LEVEL = process.env.DISCORD_TS_LOG_LEVEL?.toLocaleLowerCase();
|
const LOG_LEVEL = process.env.UNICORD_LOG_LEVEL?.toLocaleLowerCase();
|
||||||
|
|
||||||
if (LOG_LEVEL === 'debug') {
|
if (LOG_LEVEL === 'debug') {
|
||||||
const timestamp = `\x1b[37m[${new Date().toLocaleString()}]\x1b[0m`;
|
const timestamp = `\x1b[37m[${new Date().toLocaleString()}]\x1b[0m`;
|
||||||
const prefix = `\x1b[35m[discord.ts]`;
|
const prefix = `\x1b[35m[unicord]`;
|
||||||
console.log(`${timestamp} ${prefix} \x1b[0m`, ...args);
|
console.log(`${timestamp} ${prefix} \x1b[0m`, ...args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user