feat(resources): set number as keytype for Players map

This commit is contained in:
Christopher committed 2021-03-08 22:53:00 +01:00
1 parent a424a67f05
commit de53b12763
2 files changed
+3 -9

No files matched your search

+2 -4
View File
@@ -18,7 +18,7 @@ interface Credentials {
phone_number: string;
}
export const Players = new Map<string, IPlayer>();
export const Players = new Map<number, IPlayer>();
// gets the identifers
on('playerJoining', async () => {
@@ -29,8 +29,6 @@ on('playerJoining', async () => {
const identifers = getPlayerIdentifiers(pSource);
identifier = identifers[1].split(':')[1];
console.log('PHONE IS READY: ', identifier);
if (!identifier) {
throw new Error('Identifier could not be found.');
}
@@ -60,7 +58,7 @@ function getRandomPhoneNumber() {
} else {
randomNumber = Math.floor(Math.random() * 10000000)
.toString()
.replace(/(\d{3})(\d{4})/, '$1-$2'); // ;
.replace(/(\d{3})(\d{4})/, '$1-$2');
// The numbers inside {} in replace() can be changed to how many digits you want on each side of the dash.
// Example: 123-4567
}