fix(core): lowercase usernames index

This commit is contained in:
teidesu 2021-05-07 12:41:06 +03:00
parent 90e1e018f5
commit 169d95d6ed

View file

@ -115,7 +115,7 @@ export class MemoryStorage implements ITelegramStorage {
}
if (peer.username)
this._state.usernameIndex[peer.username] = peer.id
this._state.usernameIndex[peer.username.toLowerCase()] = peer.id
if (peer.phone) this._state.phoneIndex[peer.phone] = peer.id
this._state.entities[peer.id] = peer
}
@ -180,7 +180,7 @@ export class MemoryStorage implements ITelegramStorage {
}
getPeerByUsername(username: string): tl.TypeInputPeer | null {
const id = this._state.usernameIndex[username]
const id = this._state.usernameIndex[username.toLowerCase()]
if (!id) return null
const peer = this._state.entities[id]
if (!peer) return null