mirror of
https://github.com/danbulant/Shasha
synced 2026-07-06 03:21:00 +00:00
Definitely working structures
This commit is contained in:
parent
4140f5c49b
commit
b7b5d0dc5d
1 changed files with 18 additions and 15 deletions
|
|
@ -15,26 +15,29 @@ Structures.extend("Guild", g => {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get user infractions
|
* Get user infractions
|
||||||
* @param {User} get - User object
|
* @param {String} get - User ID
|
||||||
* @returns {Array<Object>} Infractions object
|
* @returns {Promise<Object[]>} Infractions object
|
||||||
*/
|
*/
|
||||||
async getInfractions(get) {
|
async getInfractions(get) {
|
||||||
let found;
|
try {
|
||||||
if (this.infractions.length > 0) {
|
const r = await database.collection("Guild").findOne({ document: this.id });
|
||||||
found = [];
|
this.infractions = r?.moderation?.infractions;
|
||||||
this.infractions.map(r => {
|
let found = [];
|
||||||
if (r) {
|
if (this.infractions.length > 0) {
|
||||||
for (const inf of r) {
|
for (const inf of this.infractions) {
|
||||||
if (inf?.by) {
|
let added = false;
|
||||||
if (inf.by.includes(get)) {
|
for (const user of inf.by) {
|
||||||
found.push(inf);
|
if (user.id === get) {
|
||||||
}
|
found.push(inf);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
if (found.length > 0) {
|
||||||
}
|
return found;
|
||||||
return found;
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
async setDefaultEmbed(set) {
|
async setDefaultEmbed(set) {
|
||||||
await database.collection("Guild").updateOne({document: this.id}, {$set:{"settings.defaultEmbed": set}}, {upsert: true}).catch(e => {throw e});
|
await database.collection("Guild").updateOne({document: this.id}, {$set:{"settings.defaultEmbed": set}}, {upsert: true}).catch(e => {throw e});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue