restructure for sveltekit
This commit is contained in:
parent
7deea47857
commit
9ef27fd2a2
73 changed files with 469 additions and 28 deletions
29
src/lib/user/user.js
Normal file
29
src/lib/user/user.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { Client } from '../client/client.js';
|
||||
import { parseText as parseEmojis } from '../emoji.js';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export default class User {
|
||||
id;
|
||||
nickname;
|
||||
username;
|
||||
host;
|
||||
avatar_url;
|
||||
emojis;
|
||||
url;
|
||||
|
||||
get name() {
|
||||
return this.nickname || this.username;
|
||||
}
|
||||
|
||||
get mention() {
|
||||
let res = "@" + this.username;
|
||||
if (this.host != get(Client.get()).instance.host)
|
||||
res += "@" + this.host;
|
||||
return res;
|
||||
}
|
||||
|
||||
get rich_name() {
|
||||
if (!this.nickname) return this.username;
|
||||
return parseEmojis(this.nickname, this.host);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue