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 & {
|
type mainuserjson = userjson & {
|
||||||
flags: number;
|
flags: number;
|
||||||
mfa_enabled?: boolean;
|
mfa_enabled?: boolean;
|
||||||
email?: string;
|
email?: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
verified: boolean;
|
verified: boolean;
|
||||||
nsfw_allowed: boolean;
|
nsfw_allowed: boolean;
|
||||||
premium: boolean;
|
premium: boolean;
|
||||||
purchased_flags: number;
|
purchased_flags: number;
|
||||||
premium_usage_flags: number;
|
premium_usage_flags: number;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
};
|
};
|
||||||
type userjson = {
|
type userjson = {
|
||||||
username: string;
|
username: string;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import{ getapiurls, getBulkInfo, setTheme, Specialuser }from"./login.js";
|
||||||
import{
|
import{
|
||||||
channeljson,
|
channeljson,
|
||||||
guildjson,
|
guildjson,
|
||||||
|
mainuserjson,
|
||||||
memberjson,
|
memberjson,
|
||||||
messageCreateJson,
|
messageCreateJson,
|
||||||
presencejson,
|
presencejson,
|
||||||
|
@ -1412,13 +1413,14 @@ class Localuser{
|
||||||
if(!json.bot){
|
if(!json.bot){
|
||||||
return alert("For some reason, this application doesn't have a bot (yet).");
|
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",
|
method:"PATCH",
|
||||||
fetchURL:this.info.api + "/applications/" + appId + "/bot",
|
fetchURL:this.info.api + "/applications/" + appId + "/bot",
|
||||||
headers:this.headers,
|
headers:this.headers,
|
||||||
traditionalSubmit:true
|
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.addFileInput("Bot avatar:","avatar");
|
||||||
form.addButtonInput("Reset Token:","Reset",async ()=>{
|
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.")){
|
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;
|
return build;
|
||||||
}
|
}
|
||||||
isTop(){
|
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)||
|
return (this.owner instanceof Options&&this.owner.subOptions!==this)||
|
||||||
(this.owner instanceof Form&&this.owner.owner.subOptions!==this.owner)||
|
(this.owner instanceof Form&&this.owner.owner.subOptions!==this.owner)||
|
||||||
(this.owner instanceof Settings)||
|
(this.owner instanceof Settings)||
|
||||||
|
@ -818,6 +815,11 @@ class Options implements OptionsElement<void>{
|
||||||
}
|
}
|
||||||
submit(){
|
submit(){
|
||||||
this.haschanged = false;
|
this.haschanged = false;
|
||||||
|
if(this.subOptions){
|
||||||
|
this.subOptions.submit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(const thing of this.options){
|
for(const thing of this.options){
|
||||||
thing.submit();
|
thing.submit();
|
||||||
}
|
}
|
||||||
|
@ -1029,6 +1031,11 @@ class Form implements OptionsElement<object>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async submit(){
|
async submit(){
|
||||||
|
if(this.options.subOptions){
|
||||||
|
this.options.subOptions.submit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("start");
|
||||||
const build = {};
|
const build = {};
|
||||||
for(const key of Object.keys(this.values)){
|
for(const key of Object.keys(this.values)){
|
||||||
const thing = this.values[key];
|
const thing = this.values[key];
|
||||||
|
@ -1051,6 +1058,7 @@ class Form implements OptionsElement<object>{
|
||||||
(build as any)[thing] = thing;
|
(build as any)[thing] = thing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("middle");
|
||||||
const promises: Promise<void>[] = [];
|
const promises: Promise<void>[] = [];
|
||||||
for(const thing of this.names.keys()){
|
for(const thing of this.names.keys()){
|
||||||
if(thing === "")continue;
|
if(thing === "")continue;
|
||||||
|
@ -1084,6 +1092,7 @@ class Form implements OptionsElement<object>{
|
||||||
}
|
}
|
||||||
(build as any)[thing] = input.value;
|
(build as any)[thing] = input.value;
|
||||||
}
|
}
|
||||||
|
console.log("middle2");
|
||||||
await Promise.allSettled(promises);
|
await Promise.allSettled(promises);
|
||||||
if(this.fetchURL !== ""){
|
if(this.fetchURL !== ""){
|
||||||
fetch(this.fetchURL, {
|
fetch(this.fetchURL, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue