get rid of the dialog class/improved notifications

This commit is contained in:
MathMan05
2024-11-27 18:16:01 -06:00
parent 258fba7b8c
commit d4d5da9da4
15 changed files with 500 additions and 785 deletions

View File

@@ -3,8 +3,8 @@ import{ Role }from"./role.js";
import{ Guild }from"./guild.js";
import{ SnowFlake }from"./snowflake.js";
import{ memberjson, presencejson }from"./jsontypes.js";
import{ Dialog }from"./dialog.js";
import { I18n } from "./i18n.js";
import { BDialog } from "./settings.js";
class Member extends SnowFlake{
static already = {};
@@ -229,28 +229,13 @@ class Member extends SnowFlake{
return this.nick || this.user.username;
}
kick(){
let reason = "";
const menu = new Dialog([
"vdiv",
["title", I18n.getTranslation("member.kick",this.name,this.guild.properties.name)],
[
"textbox",
I18n.getTranslation("member.reason:"),
"",
function(e: Event){
reason = (e.target as HTMLInputElement).value;
},
],
[
"button",
"",
I18n.getTranslation("submit"),
()=>{
this.kickAPI(reason);
menu.hide();
},
],
]);
const menu = new BDialog("");
const form=menu.options.addForm("",((e:any)=>{
this.kickAPI(e.reason);
menu.hide();
}));
form.addTitle(I18n.getTranslation("member.kick",this.name,this.guild.properties.name));
form.addTextInput(I18n.getTranslation("member.reason:"),"reason");
menu.show();
}
kickAPI(reason: string){
@@ -262,28 +247,13 @@ class Member extends SnowFlake{
});
}
ban(){
let reason = "";
const menu = new Dialog([
"vdiv",
["title", I18n.getTranslation("member.ban",this.name,this.guild.properties.name)],
[
"textbox",
I18n.getTranslation("member.reason:",this.name,this.guild.properties.name),
"",
function(e: Event){
reason = (e.target as HTMLInputElement).value;
},
],
[
"button",
"",
I18n.getTranslation("submit",this.name,this.guild.properties.name),
()=>{
this.banAPI(reason);
menu.hide();
},
],
]);
const menu = new BDialog("");
const form=menu.options.addForm("",((e:any)=>{
this.banAPI(e.reason);
menu.hide();
}));
form.addTitle(I18n.getTranslation("member.ban",this.name,this.guild.properties.name));
form.addTextInput(I18n.getTranslation("member.reason:"),"reason");
menu.show();
}
addRole(role:Role){