| 439 | } |
| 440 | |
| 441 | export async function deleteUserLevelData(client, guildId, userId) { |
| 442 | try { |
| 443 | if (!guildId || !userId) { |
| 444 | throw new TitanBotError( |
| 445 | 'Guild ID and User ID are required', |
| 446 | ErrorTypes.VALIDATION |
| 447 | ); |
| 448 | } |
| 449 | |
| 450 | const key = `${guildId}:leveling:users:${userId}`; |
| 451 | await client.db.delete(key); |
| 452 | |
| 453 | logger.debug(`Deleted level data for user ${userId} in guild ${guildId}`); |
| 454 | } catch (error) { |
| 455 | logger.error(`Error deleting level data for user ${userId}:`, error); |
| 456 | if (error instanceof TitanBotError) throw error; |
| 457 | logger.warn(`Could not delete level data for user ${userId} in guild ${guildId}`); |
| 458 | } |
| 459 | } |