mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
feat: Add Channels cache to Client with ObjectCache implementation
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
import { API } from "../api";
|
||||||
|
import { Processor } from "../processor";
|
||||||
|
import { Channel } from "../../types/channel";
|
||||||
|
import { ObjectCache } from "./cache";
|
||||||
|
|
||||||
|
export class Channels extends ObjectCache<Channel, Channel> {
|
||||||
|
constructor(api: API, processor: Processor) {
|
||||||
|
super(api, processor, 'channels', Channel, ['CHANNEL_CREATE', 'CHANNEL_UPDATE']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import { exists, isNil } from '../utils/index';
|
|||||||
import { type DiscordMessage, Message } from '../types/message';
|
import { type DiscordMessage, Message } from '../types/message';
|
||||||
import { Guilds } from './caches/guilds';
|
import { Guilds } from './caches/guilds';
|
||||||
import { Messages } from './caches/messages';
|
import { Messages } from './caches/messages';
|
||||||
|
import { Channels } from './caches/channels';
|
||||||
import { Users } from './caches/users';
|
import { Users } from './caches/users';
|
||||||
import { hydrate, hydrator, type Hydrateable, type Hydrated } from './hydrator';
|
import { hydrate, hydrator, type Hydrateable, type Hydrated } from './hydrator';
|
||||||
import { EventBus, type Emitter } from './bus';
|
import { EventBus, type Emitter } from './bus';
|
||||||
@@ -23,6 +24,7 @@ export class Client {
|
|||||||
guilds: Guilds;
|
guilds: Guilds;
|
||||||
users: Users;
|
users: Users;
|
||||||
messages: Messages;
|
messages: Messages;
|
||||||
|
channels: Channels;
|
||||||
chatCommands: Processor[HandlerType.ChatCommands];
|
chatCommands: Processor[HandlerType.ChatCommands];
|
||||||
applicationCommands: Processor[HandlerType.ApplicationCommands];
|
applicationCommands: Processor[HandlerType.ApplicationCommands];
|
||||||
interactions: Processor[HandlerType.Interactions];
|
interactions: Processor[HandlerType.Interactions];
|
||||||
@@ -43,6 +45,7 @@ export class Client {
|
|||||||
this.guilds = new Guilds(this.api, this.processor);
|
this.guilds = new Guilds(this.api, this.processor);
|
||||||
this.users = new Users(this.api, this.processor);
|
this.users = new Users(this.api, this.processor);
|
||||||
this.messages = new Messages(this, this.api, this.processor);
|
this.messages = new Messages(this, this.api, this.processor);
|
||||||
|
this.channels = new Channels(this.api, this.processor);
|
||||||
// Save references to command and event handlers
|
// Save references to command and event handlers
|
||||||
this.chatCommands = this.processor[HandlerType.ChatCommands];
|
this.chatCommands = this.processor[HandlerType.ChatCommands];
|
||||||
this.applicationCommands = this.processor[HandlerType.ApplicationCommands];
|
this.applicationCommands = this.processor[HandlerType.ApplicationCommands];
|
||||||
|
|||||||
Reference in New Issue
Block a user