Skip to content

Reactions Module

The Reactions Module (@zumito-team/reactions-module) provides a /reaction command that sends animated GIF reactions with customizable categories (kiss, angry, happy, etc.) and multi-language message templates. It includes a complete admin panel for managing categories and images.

Terminal window
npm install @zumito-team/reactions-module

Add to your zumito.config.ts:

bundles: ['@zumito-team/reactions-module']

The /reaction slash command with arguments:

ArgumentTypeRequiredDescription
categorystringYesReaction category (kiss, angry, happy, etc.).
memberuserNoTarget user. If omitted, the reaction is self-directed.

When executed:

  1. Looks up the category (merging defaults with database overrides).
  2. Resolves the locale from guild settings.
  3. Selects a random image from the category.
  4. Renders the template with %user% and %user2% placeholders.
  5. Sends a Discord embed with the image, author info, and formatted message.

Three categories come pre-configured:

CategoryOrderTemplates (EN)
kiss1%user% kissed %user2% / %user% wants to kiss themselves
angry2%user% got angry with %user2% / %user% is angry
happy3%user% got happy with %user2% / %user% is happy

Each category has a default GIF image from cdn.nekotina.com.

Accessible via the service container:

const reactions = ServiceContainer.getService('ReactionService');
MethodDescription
listCategories()List all categories with merged defaults and overrides.
getCategory(key)Get a single category by key.
upsertCategory(input)Create or update a category.
deleteCategory(key)Delete a category from the database.
addImage(categoryKey, imageInput)Add an image to a category.
updateImage(categoryKey, imageUrl, updates)Update an image’s source or description.
removeImage(categoryKey, imageUrl)Remove an image by URL.
getImagesForCategory(key)Get all images for a category.
getRandomImage(key)Get a random image from a category.
MethodPathDescription
GET/admin/reactionsCategory list with CRUD forms.
POST/admin/reactions/categoryCreate/update a category.
POST/admin/reactions/category/:key/deleteDelete a category.
GET/admin/reactions/imagesImages management page.
POST/admin/reactions/category/:key/imagesAdd image to category.
POST/admin/reactions/category/:key/images/updateUpdate image source/description.
POST/admin/reactions/category/:key/images/deleteDelete an image.

All category data is stored in the reaction_categories database collection. Categories can be managed entirely through the admin panel.

FieldTypeDescription
keystringUnique category identifier (lowercase, trimmed).
ordernumberDisplay order.
imagesReactionImage[]Array of { source: string, description?: string } objects.
translationsTranslationMapRecord<string, { mentionTemplate: string, simpleTemplate: string }> for each locale.

Templates are locale-aware and support two variants:

  • mentionTemplate — Used when a target user is specified (%user% = author, %user2% = target).
  • simpleTemplate — Used for self-reactions (%user% = author).
const reactions = ServiceContainer.getService('ReactionService');
await reactions.upsertCategory({
key: 'highfive',
order: 4,
translations: {
en: {
mentionTemplate: '%user% high-fived %user2%!',
simpleTemplate: '%user% wants a high-five!'
},
es: {
mentionTemplate: '%user% chocó los cinco con %user2%!',
simpleTemplate: '%user% quiere chocar los cinco!'
}
},
images: [
{ source: 'https://example.com/highfive1.gif', description: 'Epic high five' },
{ source: 'https://example.com/highfive2.gif', description: 'Slow motion high five' }
]
});

Consuming ReactionService in other modules

Section titled “Consuming ReactionService in other modules”
class MyModule extends Module {
requirements = { services: ['ReactionService'] };
async getRandomKissGif(): Promise<string> {
const reactions = ServiceContainer.getService('ReactionService');
const image = await reactions.getRandomImage('kiss');
return image?.source;
}
}

The translation system supports any locale key. Simply add translations for a new locale:

await reactions.upsertCategory({
key: 'kiss',
translations: {
fr: {
mentionTemplate: '%user% a embrassé %user2%!',
simpleTemplate: '%user% veut un bisou!'
}
}
});
  • @zumito-team/admin-module — For NavigationService, AdminAuthService, and AdminViewService.
  • ejs — Template rendering.
  • zumito-framework
  • Admin Module — Provides the admin panel where reactions are managed.