import type { BigString, Bot, Channel, Guild, Member, Message, ModifyWebhook, PresenceUpdate, User, Webhook } from 'discordeno' import { Collection } from 'discordeno' 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: BigString, options: ModifyWebhook, fromChannelId?: bigint ) => Promise } export interface CacheProps { guilds: Collection users: Collection members: Collection channels: Collection messages: Collection presences: Collection dispatchedGuildIds: Set dispatchedChannelIds: 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() return cacheBot }