Notification support

Be warned, there's either a bug in the server or notification level setting isn't implemented on the server side
This commit is contained in:
MathMan05
2024-06-21 16:47:45 -05:00
parent 0d5e4fc94b
commit 31f3fef52d
5 changed files with 141 additions and 0 deletions

View File

@@ -11,6 +11,11 @@ class guild{
this.markAsRead();
});
guild.contextmenu.addbutton("Notifications",function(){
console.log(this)
this.setnotifcation();
});
guild.contextmenu.addbutton("Leave guild",function(){
this.confirmleave();
},null,function(_){return _.properties.owner_id!==_.member.user.id});
@@ -67,6 +72,37 @@ class guild{
}
}
}
notisetting(settings){
this.message_notifications=settings.message_notifications;
}
setnotifcation(){
let noti=this.message_notifications
const notiselect=new fullscreen(
["vdiv",
["radio","select notifications type",
["all","only mentions","none"],
function(e){
noti=["all","only mentions","none"].indexOf(e);
},
noti
],
["button","","submit",_=>{
fetch(info.api.toString()+"/v9/users/@me/guilds/settings",{
method:"PATCH",
headers:this.headers,
body:JSON.stringify({
"guilds":{
[this.id]:{
"message_notifications": noti
}
}
})
})
this.message_notifications=noti;
}]
]);
notiselect.show();
}
confirmleave(){
const full= new fullscreen([
"vdiv",