diff --git a/src/ps2/commands/verify.command.spec.ts b/src/ps2/commands/verify.command.spec.ts index 2d1d564c..262bad90 100644 --- a/src/ps2/commands/verify.command.spec.ts +++ b/src/ps2/commands/verify.command.spec.ts @@ -150,12 +150,12 @@ describe('PS2VerifyCommand', () => { it('should return a message if the character could not be found', async () => { censusApiService.getCharacter = jest.fn().mockImplementation(() => { - throw new Error(`Character "${dto.character}" does not exist. Please ensure you have supplied your exact name.`); + throw new Error(`Character \`${dto.character}\` does not exist. Please ensure you have supplied your exact name.`); }); const response = await command.onPS2VerifyCommand(dto, mockInteraction); - expect(response).toBe(`Character "${dto.character}" does not exist. Please ensure you have supplied your exact name.`); + expect(response).toBe(`Character \`${dto.character}\` does not exist. Please ensure you have supplied your exact name.`); }); it('should correctly prevent characters outside of the outfit from registering', async () => { @@ -175,7 +175,7 @@ describe('PS2VerifyCommand', () => { const response = await command.onPS2VerifyCommand(dto, mockInteraction); - expect(response).toBe('Your character "Maelstrome26" has not been detected in the [DIG] outfit. If you are in the outfit, please log out and in again, or wait 24 hours and try again as Census (the game\'s API) can be slow to update sometimes.'); + expect(response).toBe('Your character **Maelstrome26** has not been detected in the [DIG]. If you are in the outfit, please log out and in again, or wait 24 hours and try again as Census (the game\'s API) can be slow to update sometimes.'); }); it('should return any errors presented by the verification service', async () => { @@ -192,7 +192,7 @@ describe('PS2VerifyCommand', () => { const response = await command.onPS2VerifyCommand(dto, mockInteraction); - expect(response).toBe(`Your character "${dto.character}" has been detected as a member of DIG. However, to fully verify you, you now need follow the above steps.`); + expect(response).toBe(`Your character **${dto.character}** has been detected in [DIG]. However, to ensure the character belongs to you, you now need follow the below steps.`); }); it('should correctly handle edge case character', async () => { @@ -217,6 +217,6 @@ describe('PS2VerifyCommand', () => { const response = await command.onPS2VerifyCommand(dto, mockInteraction); - expect(response).toBe('Your character "HARRYPOUSINI" has been detected as a member of DIG. However, to fully verify you, you now need follow the above steps.'); + expect(response).toBe('Your character **HARRYPOUSINI** has been detected in [DIG]. However, to ensure the character belongs to you, you now need follow the below steps.'); }); }); diff --git a/src/ps2/commands/verify.command.ts b/src/ps2/commands/verify.command.ts index 807aec7c..a0b3fc30 100644 --- a/src/ps2/commands/verify.command.ts +++ b/src/ps2/commands/verify.command.ts @@ -53,7 +53,7 @@ export class PS2VerifyCommand { // Check if the character is in the PS2 Outfit if (!character?.outfit_info || character?.outfit_info.outfit_id !== outfitId) { - return `Your character "${character.name.first}" has not been detected in the [DIG] outfit. If you are in the outfit, please log out and in again, or wait 24 hours and try again as Census (the game's API) can be slow to update sometimes.`; + return `Your character **${character.name.first}** has not been detected in the [DIG]. If you are in the outfit, please log out and in again, or wait 24 hours and try again as Census (the game's API) can be slow to update sometimes.`; } // Get the Discord guild member to be able to edit things about them @@ -69,6 +69,6 @@ export class PS2VerifyCommand { await this.ps2GameVerificationService.watch(character, guildMember); // Successful! - return `Your character "${character.name.first}" has been detected as a member of DIG. However, to fully verify you, you now need follow the above steps.`; + return `Your character **${character.name.first}** has been detected in [DIG]. However, to ensure the character belongs to you, you now need follow the below steps.`; } } diff --git a/src/ps2/service/census.api.service.spec.ts b/src/ps2/service/census.api.service.spec.ts index 9ad2d380..ad7dd478 100644 --- a/src/ps2/service/census.api.service.spec.ts +++ b/src/ps2/service/census.api.service.spec.ts @@ -75,7 +75,7 @@ describe('CensusApiService', () => { test('should throw an error if a character doesn\'t exist', async () => { const name = 'IDoNotExist101010101010101'; - await expect(service.getCharacter(name)).rejects.toThrowError(`Character **${name}** does not exist.`); + await expect(service.getCharacter(name)).rejects.toThrowError(`Character \`${name}\` does not exist. Please ensure you have spelt it correctly.`); }, 10000); test('should return a character, and also returns outfit details (by ID)', async () => { diff --git a/src/ps2/service/census.api.service.ts b/src/ps2/service/census.api.service.ts index 943959f9..aeb59927 100644 --- a/src/ps2/service/census.api.service.ts +++ b/src/ps2/service/census.api.service.ts @@ -59,7 +59,7 @@ export class CensusApiService implements OnModuleInit { const response: CensusCharacterResponseInterface = await this.requestWithRetries(url); if (response.returned === 0 || !response.character_list || response.character_list.length === 0) { - throw new Error(`Character **${characterName}** does not exist.`); + throw new Error(`Character \`${characterName}\` does not exist. Please ensure you have spelt it correctly.`); } return response.character_list[0]; diff --git a/src/ps2/service/ps2.game.verification.service.ts b/src/ps2/service/ps2.game.verification.service.ts index ed2c5b51..1b9c2ed8 100644 --- a/src/ps2/service/ps2.game.verification.service.ts +++ b/src/ps2/service/ps2.game.verification.service.ts @@ -82,13 +82,14 @@ export class PS2GameVerificationService implements OnApplicationBootstrap { this.monitoringCharacters.set(character.character_id, character); this.logger.debug(`Added character ${character.name.first} to watch list`); - const message = await this.sendMessage(`Verification status for ${character.name.first}: ⏳Setting up watcher for ${character.name.first} for verification...`); - const timeMessage = await this.sendMessage(`Time remaining: ⏳**${this.calculateTimeRemaining(deadline)}**`); + const message = await this.sendMessage(`Verification status for \`${character.name.first}\`: ⏳Setting up watcher for ${character.name.first} for verification...`); + const timeMessage = await this.sendMessage(`⏳ Time remaining for \`${character.name.first}\`: **${this.calculateTimeRemaining(deadline)}**`); // Tell the websocket service to start monitoring the character for deaths this.censusWebsocketService.watchCharacter(character); - await this.editMessage(`## Verification status for ${character.name.first}: ⏳__Pending__\n\n⏳Deploy to a continent and to a base outside of Warpgates / Flotillas. Then type **/suicide** in the in-game chat for character "${character.name.first}". `, message); + await this.editMessage(`## Verification status for \`${character.name.first}\`: ⏳__Pending__\n + \n➡️ Deploy to a continent and to a base __outside__ of Warpgates / Flotillas. Then type **/suicide** in the in-game chat for character \`${character.name.first}\`. `, message); // Store the messages to reference for later so we can edit the message and also reply to it etc. this.messagesMap.set(character.character_id, message); @@ -168,7 +169,7 @@ export class PS2GameVerificationService implements OnApplicationBootstrap { const isSuicide = deathEvent.attacker_character_id === deathEvent.character_id; if (!isSuicide) { - await this.editMessage(`## Verification status for ${character.name.first}: ⏳__Pending__\n\n⚠️ Death for character "${character.name.first}" detected, but it wasn't a suicide. Type **/suicide** in the game chat for the quickest way to do this.`, message); + await this.editMessage(`## Verification status for \`${character.name.first}\`: ⏳__Pending__\n\n⚠️ Death for character "${character.name.first}" detected, but it wasn't a suicide. Type **/suicide** in the game chat for the quickest way to do this.`, message); return; } @@ -180,7 +181,7 @@ export class PS2GameVerificationService implements OnApplicationBootstrap { this.logger.debug('Handling failed verification'); const message = this.messagesMap.get(character.character_id); message.channel.sendTyping(); - await this.editMessage(`## Verification status for ${character.name.first}: ❌ __FAILED__\n\nReason: ${failureReason}`, message); + await this.editMessage(`## Verification status for \`${character.name.first}\`: ❌ __FAILED__\n\nReason: ${failureReason}`, message); if (isError) { message.channel.send(failureReason); @@ -200,7 +201,7 @@ export class PS2GameVerificationService implements OnApplicationBootstrap { } } - message.channel.send(`<@${guildMember.id}> your in game character "${character.name.first}" could not be verified! Please read the reason as to why above. Feel free to contact the PS2 Leaders for assistance.`); + message.channel.send(`😔 <@${guildMember.id}> your in game character "${character.name.first}" could not be verified! Please read the reason as to why above. Feel free to contact the PS2 Leaders for assistance.`); } private async handleSuccessfulVerification(character: CensusCharacterWithOutfitInterface) { @@ -258,10 +259,13 @@ export class PS2GameVerificationService implements OnApplicationBootstrap { await this.handleFailedVerification(character, `${errorMessage} Pinging <@${this.config.get('discord.devUserId')}>! Error: ${err.message}`, guildMember, true); } - await this.editMessage(`## Verification status for ${character.name.first}: ✅ __Successful__`, message); + await this.editMessage(`## Verification status for \`${character.name.first}\`: ✅ __Successful__`, message); await this.unwatch(character); - message.channel.send(`<@${guildMember.id}> your in game character "${character.name.first}" has been successfully verified! Welcome to the [DIG] outfit! 🎉 \nYou can now see our private section <#${this.config.get('discord.channels.ps2Private')}>.\nInfo on how to be promoted to Zealot to use our Armory assets, visit <#${this.config.get('discord.channels.ps2HowToRankUp')}>.`); + message.channel.send(`🎉 <@${guildMember.id}> your in game character "${character.name.first}" has been successfully verified! Welcome to the [DIG] outfit! + \n🔓 You can now see our private section <#${this.config.get('discord.channels.ps2Private')}>. Should you leave the outfit, you will automatically lose this access. + \nℹ️ Info on how to be promoted to Zealot to use our Armory assets, visit <#${this.config.get('discord.channels.ps2HowToRankUp')}>. + \n=================`); } private checkMonitoredCharacters() { @@ -282,7 +286,9 @@ export class PS2GameVerificationService implements OnApplicationBootstrap { return; } const timeRemaining = this.calculateTimeRemaining(deadline); - if (timeMessage) {await this.editMessage(`Time remaining: ⏳ **${timeRemaining}**`, timeMessage);} + if (timeMessage) { + await this.editMessage(`⏳ Time remaining for \`${character.name.first}\`: **${timeRemaining}**`, timeMessage); + } this.logger.debug(`${character.name.first} still pending verification (${timeRemaining} remaining)`); }); }