3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 23:25:02 +00:00

Add case_id to mutes. Add !mutes command to list mutes.

This commit is contained in:
Dragory 2018-08-05 00:18:50 +03:00
parent 128ae87b41
commit 3991858511
9 changed files with 131 additions and 3 deletions

View file

@ -69,6 +69,22 @@ export class GuildMutes {
}
}
async getActiveMutes(): Promise<Mute[]> {
const result = await knex("mutes")
.where("guild_id", this.guildId)
.where(q => q.whereRaw("expires_at > NOW()").orWhereNull("expires_at"))
.select();
return result.map(r => new Mute(r));
}
async setCaseId(userId, caseId) {
await knex("mutes")
.where("guild_id", this.guildId)
.where("user_id", userId)
.update({ case_id: caseId });
}
async clear(userId) {
return knex("mutes")
.where("guild_id", this.guildId)