Enhance bot command handling with new leveling, economy, and utility features

- Integrated leveling and economy commands, including XP management and shop interactions.
- Added context menu support for utility commands, improving user interaction options.
- Updated command registration to include new commands and context menus, enhancing overall functionality.
- Improved logging to track the registration of commands and context menus.
- Refactored interaction handling to accommodate new command types and ensure smooth execution.
This commit is contained in:
smueller
2026-07-22 12:56:00 +02:00
parent fa5910ec43
commit 58623bd1d3
8 changed files with 140 additions and 43 deletions

View File

@@ -0,0 +1,22 @@
import { describe, expect, it } from 'vitest';
import { levelFromXp, progressInLevel, totalXpForLevel, xpForNextLevel } from './phase3.js';
describe('phase3 xp helpers', () => {
it('computes xp for next level', () => {
expect(xpForNextLevel(0)).toBe(100);
expect(xpForNextLevel(1)).toBe(155);
});
it('derives level from xp', () => {
expect(levelFromXp(0)).toBe(0);
expect(levelFromXp(100)).toBe(1);
expect(levelFromXp(totalXpForLevel(5))).toBe(5);
});
it('reports progress in current level', () => {
const progress = progressInLevel(totalXpForLevel(2) + 10);
expect(progress.level).toBe(2);
expect(progress.intoLevel).toBe(10);
expect(progress.needed).toBe(xpForNextLevel(2));
});
});