Skip to content
GitHub

useTheme

function in meocord/common Since 4.1.0

useTheme(): ResolvedTheme

The theme of the running call, with every role present.

Read it wherever a call runs: in a handler, in a service or presenter it calls, and in work it starts, such as a timer's follow-up. Outside a call, it is the theme of the app the process runs, from when its start begins until the start fails or the app has shut down, its onShutdown hooks included, and MeoCord's defaults otherwise; it never throws.

Returns

ResolvedTheme

The resolved theme, with every role present.

Examples

TypeScript
@Command('save', CommandType.SLASH)
async save(interaction: ChatInputCommandInteraction) {
  const { colors, emojis } = useTheme()
  await respond(interaction).send({ embeds: [{ description: `${emojis.success} Saved`, color: resolveColor(colors.success) }] })
}