The problem is this line: player = app.state.sessions.players.get(name=ctx.args[1]). This only works for online users. Instead, it should be using the users repository to lookup the player from the database. There should be good examples around the codebase of using the users_repo to fetch_one user, by username or user id.
Code reference: https://github.com/osuAkatsuki/bancho.py/blob/more-sqlalchemy/app/commands.py#L358-L411
The problem is this line:
player = app.state.sessions.players.get(name=ctx.args[1])
. This only works for online users. Instead, it should be using the users repository to lookup the player from the database. There should be good examples around the codebase of using theusers_repo
tofetch_one
user, by username or user id.