mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-10-23 17:12:25 +00:00
add message box to user profiles
This commit is contained in:
1 parent
5868dbd76d
commit
91894d509e
4 files changed
+46
-4
No files matched your search
@@ -49,7 +49,7 @@ class InfiniteScroller {
|
||||
|
||||
async getDiv(initialId: string): Promise<HTMLDivElement> {
|
||||
if (this.div) {
|
||||
throw new Error("Div already exists, exiting.");
|
||||
return this.div;
|
||||
}
|
||||
this.resetVars();
|
||||
const scroll = document.createElement("div");
|
||||
|
||||
@@ -2598,6 +2598,17 @@ img.bigembedimg {
|
||||
animation-fill-mode: forwards;
|
||||
animation-timing-function: cubic-bezier(0.28, 0.48, 0.24, 1.27);
|
||||
}
|
||||
input {
|
||||
width: calc(100% - 20px);
|
||||
margin: 0px 10px;
|
||||
margin-bottom: 10px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
background: var(--secondary-bg);
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
@keyframes fade-in {
|
||||
0% {
|
||||
|
||||
+32
-2
@@ -154,10 +154,12 @@ class User extends SnowFlake {
|
||||
}
|
||||
|
||||
static contextmenu = new Contextmenu<User, Member | undefined>("User Menu");
|
||||
async opendm() {
|
||||
async opendm(message?: string) {
|
||||
for (const dm of (this.localuser.guildids.get("@me") as Direct).channels) {
|
||||
if (dm.type === 1 && dm.users[0].id === this.id) {
|
||||
if ((dm.type === 1 || dm.type === undefined) && dm.users[0].id === this.id) {
|
||||
this.localuser.goToChannel(dm.id);
|
||||
if (message)
|
||||
dm.sendMessage(message, {attachments: [], embeds: [], replyingto: null, sticker_ids: []});
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -171,6 +173,22 @@ class User extends SnowFlake {
|
||||
.then((json) => {
|
||||
this.localuser.goToChannel(json.id);
|
||||
});
|
||||
if (message) {
|
||||
while (true) {
|
||||
for (const dm of (this.localuser.guildids.get("@me") as Direct).channels) {
|
||||
if ((dm.type === 1 || dm.type === undefined) && dm.users[0].id === this.id) {
|
||||
dm.sendMessage(message, {
|
||||
attachments: [],
|
||||
embeds: [],
|
||||
replyingto: null,
|
||||
sticker_ids: [],
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
await new Promise((res) => setTimeout(res, 100));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
async changeRelationship(type: 0 | 1 | 2 | 3 | 4 | 5) {
|
||||
@@ -1111,9 +1129,20 @@ class User extends SnowFlake {
|
||||
}
|
||||
});
|
||||
|
||||
const send = document.createElement("input");
|
||||
div.append(send);
|
||||
send.placeholder = I18n.user.sendMessage(this.name);
|
||||
send.onkeyup = (e) => {
|
||||
if (e.key === "Enter") {
|
||||
this.opendm(send.value);
|
||||
div.remove();
|
||||
}
|
||||
};
|
||||
|
||||
if (guild) {
|
||||
membres.then((member) => {
|
||||
if (!member) return;
|
||||
send.placeholder = I18n.user.sendMessage(member.name);
|
||||
usernamehtml.textContent = member.name;
|
||||
if (this.bot) {
|
||||
const username = document.createElement("span");
|
||||
@@ -1139,6 +1168,7 @@ class User extends SnowFlake {
|
||||
userbody.append(roles);
|
||||
});
|
||||
}
|
||||
|
||||
if (x !== -1) {
|
||||
Contextmenu.declareMenu(div);
|
||||
document.body.appendChild(div);
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
"searchGifs": "Search Tenor",
|
||||
"muteDuration":"Unmute in:",
|
||||
"channel": {
|
||||
"typebox":"Message in $1",
|
||||
"typebox":"Message in $1",
|
||||
"creating": "Creating channel",
|
||||
"name": "Channel",
|
||||
"copyId": "Copy channel id",
|
||||
@@ -622,6 +622,7 @@
|
||||
"name": "Direct Messages"
|
||||
},
|
||||
"user": {
|
||||
"sendMessage":"Message @$1",
|
||||
"copyId": "Copy user ID",
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
|
||||
Reference in new issue
Block a user