Skip to content

HugeTicket/hugeticket-plugin-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HugeTicket Plugin Template

This is a starter template to build a plugin for HugeTicket. It provides:

  • A local PLUGIN_HOOKS constant for autocomplete
  • Fully typed example:event hook payload
  • Plugin-local models, utils, and handlers
  • No core modifications required

How to Use

  1. Rename the plugin folder and update plugin.json
  2. Replace example:event with your own hook name
  3. Define payload types in types/hooks.d.ts
  4. Register new handlers inside handlers/

How to Add Another Handler

  1. Add the event to constants/hooks.ts:
export const PLUGIN_HOOKS = {
  EXAMPLE_EVENT: "example:event",
  NEW_EVENT: "ticket:extra_action",
} as const;
  1. Extend the type in types/hooks.d.ts:
interface HookTypes {
  "ticket:extra_action": {
    ticketId: string;
    note: string;
  };
}
  1. Add a handler in handlers/onExtraAction.ts:
on(PLUGIN_HOOKS.NEW_EVENT, async ({ ticketId, note }) => {
  console.log("New action received:", ticketId, note);
});
  1. Import it in index.ts.

How to Get Autocomplete

Use PLUGIN_HOOKS.YOUR_EVENT instead of raw strings like "your:event". This gives autocomplete and avoids typos.

Want to Publish?

Just zip this folder or publish it as a git repo. No need to use npm for private plugins.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors