sup.lookup
The sup.lookup package resolves platform entities by ID or slug. It is useful when your patch already knows a concrete identifier and wants the corresponding Sup object.
Unlike sup.search, lookup does not perform semantic search. It attempts to fetch an exact entity and returns undefined when nothing matches.
const patch = sup.lookup.patch('cm37fypg7000108l2fwt82751');if (!patch) return 'Patch not found';
return patch.run('hello');Methods
sup.lookup.chat()
(id: string) → SupChat | undefined
const chat = sup.lookup.chat('cm37h4ky3000108mego5udiz4');if (chat) { return chat.title;}Looks up a chat by ID.
sup.lookup.emoji()
(idOrSlug: string) → SupEmoji | undefined
const emoji = sup.lookup.emoji('star');if (emoji) { return [emoji, `Found ${emoji.name}`];}Looks up an emoji by ID or slug.
sup.lookup.patch()
(idOrSlug: string) → SupPatch | undefined
const patch = sup.lookup.patch('/shahruz/weather');if (!patch) return 'Patch not found';
return patch.run();Looks up a patch by ID or slug.
sup.lookup.user()
(idOrUsername: string) → SupUser | undefined
const user = sup.lookup.user('shahruz');if (user) { return `Found @${user.username}`;}Looks up a user by ID or username.
When To Use
- Use
sup.lookupwhen you already know the exact ID or slug. - Use
sup.searchwhen you want fuzzy or semantic discovery.