guild settings

This commit is contained in:
MathMan05
2024-09-10 14:52:30 -05:00
parent 72ac3a14ed
commit 68ab121d63
7 changed files with 45 additions and 62 deletions

View File

@@ -14,7 +14,7 @@ class Guild extends SnowFlake{
owner:Localuser;
headers:Localuser["headers"];
channels:Channel[];
properties;
properties:guildjson["properties"];
member_count:number;
roles:Role[];
roleids:Map<string,Role>;
@@ -79,7 +79,15 @@ class Guild extends SnowFlake{
fetchURL:this.info.api+"/guilds/"+this.id,
method:"PATCH"
})
form.addTextInput("Name:","name",{initText:this.properties.name})
form.addTextInput("Name:","name",{initText:this.properties.name});
form.addMDInput("Description:","description",{initText:this.properties.description});
form.addFileInput("Banner:","banner",{clear:true});
form.addFileInput("Icon:","icon",{clear:true});
let region=this.properties.region;
if(!region){
region="";
}
form.addTextInput("Region:","region",{initText:region});
}
const s1=settings.addButton("roles");
const permlist:[Role,Permissions][]=[];

View File

@@ -179,6 +179,7 @@ type guildjson={
member_count: number,
premium_subscription_count: number,
properties: {
region: string|null,
name: string,
description: string,
icon: string,
@@ -359,50 +360,7 @@ type invitejson={
target_user_type: string|null,
vanity_url: string|null,
flags: number,
guild: {
id: string,
afk_channel_id: string|null,
afk_timeout: number,
banner: string|null,
default_message_notifications: number,
description: string|null,
discovery_splash: string|null,
explicit_content_filter: number,
features: [],
primary_category_id: string|null,
icon: string|null,
large: boolean,
max_members: number,
max_presences: number,
max_video_channel_users: number,
member_count: number,
presence_count: number,
template_id: string|null,
mfa_level: number,
name: string,
owner_id: string,
preferred_locale: string,
premium_subscription_count: number,
premium_tier: number,
public_updates_channel_id: string|null,
rules_channel_id: string|null,
region: string|null,
splash: string|null,
system_channel_id: string|null,
system_channel_flags: number,
verification_level: number,
welcome_screen: {
enabled: boolean,
description: string,
welcome_channels: string[]
},
widget_channel_id: string|null,
widget_enabled: boolean,
nsfw_level: number,
nsfw: boolean,
parent: string|null,
premium_progress_bar_enabled: boolean
},
guild: guildjson["properties"],
channel: channeljson,
inviter: userjson
}

View File

@@ -295,8 +295,8 @@ class Message extends SnowFlake{
next.generateMessage();
next=this.channel.messages.get(this.channel.idToNext.get(next.id) as string);
}
if(this.channel.infinite.div&&scroll){
this.channel.infinite.div.scrollTop=scroll;
if(this.channel.infinite.scollDiv&&scroll){
this.channel.infinite.scollDiv.scrollTop=scroll;
}
};
}
@@ -327,9 +327,9 @@ class Message extends SnowFlake{
next=this.channel.messages.get(this.channel.idToNext.get(next.id) as string);
console.log("loopy");
}
if(this.channel.infinite.div&&scroll){
if(this.channel.infinite.scollDiv&&scroll){
func();
this.channel.infinite.div.scrollTop=scroll;
this.channel.infinite.scollDiv.scrollTop=scroll;
}
};
div.appendChild(build);

View File

@@ -404,9 +404,11 @@ class FileInput implements OptionsElement<FileList|null>{
onChange(ev:Event){
this.owner.changed();
const input=this.input.deref();
if(this.onchange&&input){
if(input){
this.value=input.files;
this.onchange(input.files);
if(this.onchange){
this.onchange(input.files);
}
}
}
onchange:((str:FileList|null)=>void)|null=null;
@@ -706,8 +708,9 @@ class Form implements OptionsElement<object>{
return select;
}
readonly fileOptions:Map<FileInput,{files:"one"|"multi"}>=new Map();
addFileInput(label:string,formName:string,{required,files}:{required:boolean,files:"one"|"multi"}={required:false,files:"multi"}){
const FI=this.options.addFileInput(label,_=>{},{});
addFileInput(label:string,formName:string,{required=false,files="one",clear=false}={}){
const FI=this.options.addFileInput(label,_=>{},{clear});
if(files!=="one"&&files!=="multi") throw new Error("files should equal one or multi");
this.fileOptions.set(FI,{files});
this.names.set(formName,FI);
if(required){
@@ -815,6 +818,7 @@ class Form implements OptionsElement<object>{
throw new Error("FileInput without its options is in this form, this should never happen.");
}
if(options.files==="one"){
console.log(input.value);
if(input.value){
const reader=new FileReader();
reader.readAsDataURL(input.value[0]);