fixes
This commit is contained in:
parent
550a7d7cf3
commit
39cf289d2e
3 changed files with 26 additions and 15 deletions
|
@ -117,16 +117,16 @@ flags: number;
|
|||
};
|
||||
};
|
||||
type mainuserjson = userjson & {
|
||||
flags: number;
|
||||
mfa_enabled?: boolean;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
verified: boolean;
|
||||
nsfw_allowed: boolean;
|
||||
premium: boolean;
|
||||
purchased_flags: number;
|
||||
premium_usage_flags: number;
|
||||
disabled: boolean;
|
||||
flags: number;
|
||||
mfa_enabled?: boolean;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
verified: boolean;
|
||||
nsfw_allowed: boolean;
|
||||
premium: boolean;
|
||||
purchased_flags: number;
|
||||
premium_usage_flags: number;
|
||||
disabled: boolean;
|
||||
};
|
||||
type userjson = {
|
||||
username: string;
|
||||
|
|
|
@ -8,6 +8,7 @@ import{ getapiurls, getBulkInfo, setTheme, Specialuser }from"./login.js";
|
|||
import{
|
||||
channeljson,
|
||||
guildjson,
|
||||
mainuserjson,
|
||||
memberjson,
|
||||
messageCreateJson,
|
||||
presencejson,
|
||||
|
@ -1412,13 +1413,14 @@ class Localuser{
|
|||
if(!json.bot){
|
||||
return alert("For some reason, this application doesn't have a bot (yet).");
|
||||
}
|
||||
const form=container.addSubForm("Editing bot "+json.bot.username,()=>{},{
|
||||
const bot:mainuserjson=json.bot;
|
||||
const form=container.addSubForm("Editing bot "+bot.username,out=>{console.log(out)},{
|
||||
method:"PATCH",
|
||||
fetchURL:this.info.api + "/applications/" + appId + "/bot",
|
||||
headers:this.headers,
|
||||
traditionalSubmit:true
|
||||
});
|
||||
form.addTextInput("Bot username:","username",{initText:json.bot.username});
|
||||
form.addTextInput("Bot username:","username",{initText:bot.username});
|
||||
form.addFileInput("Bot avatar:","avatar");
|
||||
form.addButtonInput("Reset Token:","Reset",async ()=>{
|
||||
if(!confirm("Are you sure you want to reset the bot token? Your bot will stop working until you update it.")){
|
||||
|
|
|
@ -748,9 +748,6 @@ class Options implements OptionsElement<void>{
|
|||
return build;
|
||||
}
|
||||
isTop(){
|
||||
(this.owner instanceof Form&&this.owner.owner.subOptions!==this.owner),
|
||||
(this.owner instanceof Settings),
|
||||
(this.owner instanceof Buttons));
|
||||
return (this.owner instanceof Options&&this.owner.subOptions!==this)||
|
||||
(this.owner instanceof Form&&this.owner.owner.subOptions!==this.owner)||
|
||||
(this.owner instanceof Settings)||
|
||||
|
@ -818,6 +815,11 @@ class Options implements OptionsElement<void>{
|
|||
}
|
||||
submit(){
|
||||
this.haschanged = false;
|
||||
if(this.subOptions){
|
||||
this.subOptions.submit();
|
||||
return;
|
||||
}
|
||||
|
||||
for(const thing of this.options){
|
||||
thing.submit();
|
||||
}
|
||||
|
@ -1029,6 +1031,11 @@ class Form implements OptionsElement<object>{
|
|||
}
|
||||
}
|
||||
async submit(){
|
||||
if(this.options.subOptions){
|
||||
this.options.subOptions.submit();
|
||||
return;
|
||||
}
|
||||
console.log("start");
|
||||
const build = {};
|
||||
for(const key of Object.keys(this.values)){
|
||||
const thing = this.values[key];
|
||||
|
@ -1051,6 +1058,7 @@ class Form implements OptionsElement<object>{
|
|||
(build as any)[thing] = thing;
|
||||
}
|
||||
}
|
||||
console.log("middle");
|
||||
const promises: Promise<void>[] = [];
|
||||
for(const thing of this.names.keys()){
|
||||
if(thing === "")continue;
|
||||
|
@ -1084,6 +1092,7 @@ class Form implements OptionsElement<object>{
|
|||
}
|
||||
(build as any)[thing] = input.value;
|
||||
}
|
||||
console.log("middle2");
|
||||
await Promise.allSettled(promises);
|
||||
if(this.fetchURL !== ""){
|
||||
fetch(this.fetchURL, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue