import { Bot, Channel, Collection, Guild, Member, Message, ModifyWebhook, PresenceUpdate, User, Webhook, } from "../deps.ts"; export type BotWithCache = Omit & CacheProps & { helpers: BotHelpersWithCache; }; export type BotHelpersWithCache = Omit & { /** The added channelId argument at the end is used to validate permission checks */ editWebhook: (webhookId: bigint, options: ModifyWebhook, fromChannelId?: bigint) => Promise; }; export interface CacheProps { guilds: Collection; users: Collection; members: Collection; channels: Collection; messages: Collection; presences: Collection; dispatchedGuildIds: Set; dispatchedChannelIds: Set; activeGuildIds: Set; } export function addCacheCollections(bot: B): BotWithCache { const cacheBot = bot as unknown as BotWithCache; cacheBot.guilds = new Collection(); cacheBot.users = new Collection(); cacheBot.members = new Collection(); cacheBot.channels = new Collection(); cacheBot.messages = new Collection(); cacheBot.presences = new Collection(); cacheBot.dispatchedGuildIds = new Set(); cacheBot.dispatchedChannelIds = new Set(); cacheBot.activeGuildIds = new Set(); return cacheBot; }