(content, config)
| 263 | } |
| 264 | |
| 265 | export function isValidCountingMessage(content, config) { |
| 266 | const trimmed = content.trim(); |
| 267 | const system = COUNTING_SYSTEMS[config.system] ? config.system : 'decimal'; |
| 268 | const current = COUNTING_SYSTEMS[system]; |
| 269 | if (system === 'math') { |
| 270 | const parsedValue = current.parse(trimmed); |
| 271 | return parsedValue === config.nextNumber; |
| 272 | } |
| 273 | |
| 274 | const expected = current.toString(config.nextNumber || 1); |
| 275 | if (system === 'alphabet' || system === 'roman') { |
| 276 | return trimmed.toUpperCase() === expected.toUpperCase(); |
| 277 | } |
| 278 | return trimmed === expected; |
| 279 | } |
| 280 | |
| 281 | export async function activateCountingGame(client, guildId, channelId, system = 'decimal') { |
| 282 | const normalizedSystem = COUNTING_SYSTEMS[system] ? system : 'decimal'; |
no outgoing calls
no test coverage detected