get invite embeds working
This commit is contained in:
parent
7915032462
commit
1502dbec17
8 changed files with 500 additions and 46 deletions
|
@ -7,7 +7,7 @@ import{Member}from"./member.js";
|
|||
import{Settings}from"./settings.js";
|
||||
import{Permissions}from"./permissions.js";
|
||||
import{ SnowFlake }from"./snowflake.js";
|
||||
import{ channeljson, guildjson, emojijson, memberjson }from"./jsontypes.js";
|
||||
import{ channeljson, guildjson, emojijson, memberjson, invitejson }from"./jsontypes.js";
|
||||
import{ User }from"./user.js";
|
||||
|
||||
class Guild extends SnowFlake{
|
||||
|
@ -274,39 +274,60 @@ class Guild extends SnowFlake{
|
|||
return a.position-b.position;
|
||||
});
|
||||
}
|
||||
generateGuildIcon(){
|
||||
static generateGuildIcon(guild:Guild|(invitejson["guild"] & {info:{cdn:string}})){
|
||||
const divy=document.createElement("div");
|
||||
divy.classList.add("servernoti");
|
||||
|
||||
const noti=document.createElement("div");
|
||||
noti.classList.add("unread");
|
||||
divy.append(noti);
|
||||
this.localuser.guildhtml.set(this.id,divy);
|
||||
if(this.properties.icon!=null){
|
||||
if(guild instanceof Guild){
|
||||
guild.localuser.guildhtml.set(guild.id,divy);
|
||||
}
|
||||
let icon:string|null
|
||||
if(guild instanceof Guild){
|
||||
icon=guild.properties.icon;
|
||||
}else{
|
||||
icon=guild.icon;
|
||||
}
|
||||
if(icon!==null){
|
||||
const img=document.createElement("img");
|
||||
img.classList.add("pfp","servericon");
|
||||
img.src=this.info.cdn+"/icons/"+this.properties.id+"/"+this.properties.icon+".png";
|
||||
img.src=guild.info.cdn+"/icons/"+guild.id+"/"+icon+".png";
|
||||
divy.appendChild(img);
|
||||
img.onclick=()=>{
|
||||
console.log(this.loadGuild);
|
||||
this.loadGuild();
|
||||
this.loadChannel();
|
||||
};
|
||||
Guild.contextmenu.bindContextmenu(img,this,undefined);
|
||||
if(guild instanceof Guild){
|
||||
img.onclick=()=>{
|
||||
console.log(guild.loadGuild);
|
||||
guild.loadGuild();
|
||||
guild.loadChannel();
|
||||
};
|
||||
Guild.contextmenu.bindContextmenu(img,guild,undefined);
|
||||
}
|
||||
}else{
|
||||
const div=document.createElement("div");
|
||||
const build=this.properties.name.replace(/'s /g, " ").replace(/\w+/g, word=>word[0]).replace(/\s/g, "");
|
||||
let name:string
|
||||
if(guild instanceof Guild){
|
||||
name=guild.properties.name;
|
||||
}else{
|
||||
name=guild.name;
|
||||
}
|
||||
const build=name.replace(/'s /g, " ").replace(/\w+/g, word=>word[0]).replace(/\s/g, "");
|
||||
div.textContent=build;
|
||||
div.classList.add("blankserver","servericon");
|
||||
divy.appendChild(div);
|
||||
div.onclick=()=>{
|
||||
this.loadGuild();
|
||||
this.loadChannel();
|
||||
};
|
||||
Guild.contextmenu.bindContextmenu(div,this,undefined);
|
||||
if(guild instanceof Guild){
|
||||
div.onclick=()=>{
|
||||
guild.loadGuild();
|
||||
guild.loadChannel();
|
||||
};
|
||||
Guild.contextmenu.bindContextmenu(div,guild,undefined);
|
||||
}
|
||||
}
|
||||
return divy;
|
||||
}
|
||||
generateGuildIcon(){
|
||||
return Guild.generateGuildIcon(this);
|
||||
}
|
||||
confirmDelete(){
|
||||
let confirmname="";
|
||||
const full= new Dialog([
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue