2025-06-30 10:30:37 +08:00
|
|
|
import { IPlugin } from "@/src/types/pluginTypes";
|
|
|
|
import { logger } from "@/src/utils/logger";
|
|
|
|
|
|
|
|
export default class ExamplePlugin implements IPlugin {
|
|
|
|
public name = "ExamplePlugin";
|
|
|
|
public version = "1.0.0";
|
|
|
|
public description = "Example plugin for the server";
|
|
|
|
public author = "Your Name";
|
|
|
|
|
|
|
|
async initialize(): Promise<void> {
|
|
|
|
logger.info(`[${this.name}] Plugin initialized successfully!`);
|
2025-06-30 10:44:54 +08:00
|
|
|
|
2025-06-30 10:30:37 +08:00
|
|
|
// Add your plugin initialization logic here
|
|
|
|
// For example:
|
|
|
|
// - Register new routes
|
|
|
|
// - Add new API endpoints
|
|
|
|
// - Set up event listeners
|
|
|
|
// - Connect to external services
|
2025-06-30 10:44:54 +08:00
|
|
|
await Promise.resolve(); // Simulate async operation if needed
|
2025-06-30 10:30:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async cleanup(): Promise<void> {
|
|
|
|
logger.info(`[${this.name}] Plugin cleanup completed`);
|
2025-06-30 10:44:54 +08:00
|
|
|
|
2025-06-30 10:30:37 +08:00
|
|
|
// Add your cleanup logic here
|
|
|
|
// For example:
|
|
|
|
// - Close database connections
|
|
|
|
// - Clear timers/intervals
|
|
|
|
// - Remove event listeners
|
2025-06-30 10:44:54 +08:00
|
|
|
await Promise.resolve(); // Simulate async operation if needed
|
2025-06-30 10:30:37 +08:00
|
|
|
}
|
|
|
|
}
|