mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +00:00
initial commit
This commit is contained in:
parent
a088476f96
commit
9aa4516a3a
1 changed files with 25 additions and 20 deletions
|
@ -37,6 +37,7 @@ const ConfigSchema = t.type({
|
||||||
message_channel: tNullable(t.string),
|
message_channel: tNullable(t.string),
|
||||||
mute_message: tNullable(t.string),
|
mute_message: tNullable(t.string),
|
||||||
timed_mute_message: tNullable(t.string),
|
timed_mute_message: tNullable(t.string),
|
||||||
|
update_mute_message: tNullable(t.string),
|
||||||
|
|
||||||
can_view_list: t.boolean,
|
can_view_list: t.boolean,
|
||||||
can_cleanup: t.boolean,
|
can_cleanup: t.boolean,
|
||||||
|
@ -86,6 +87,7 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
message_channel: null,
|
message_channel: null,
|
||||||
mute_message: "You have been muted on the {guildName} server. Reason given: {reason}",
|
mute_message: "You have been muted on the {guildName} server. Reason given: {reason}",
|
||||||
timed_mute_message: "You have been muted on the {guildName} server for {time}. Reason given: {reason}",
|
timed_mute_message: "You have been muted on the {guildName} server for {time}. Reason given: {reason}",
|
||||||
|
update_mute_message: "Your mute on the {guildName} server has been updated to {time}.",
|
||||||
|
|
||||||
can_view_list: false,
|
can_view_list: false,
|
||||||
can_cleanup: false,
|
can_cleanup: false,
|
||||||
|
@ -144,6 +146,7 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const user = await this.resolveUser(userId);
|
const user = await this.resolveUser(userId);
|
||||||
const member = await this.getMember(user.id, true); // Grab the fresh member so we don't have stale role info
|
const member = await this.getMember(user.id, true); // Grab the fresh member so we don't have stale role info
|
||||||
|
const config = this.getMatchingConfig({ member, userId });
|
||||||
|
|
||||||
if (member) {
|
if (member) {
|
||||||
// Apply mute role if it's missing
|
// Apply mute role if it's missing
|
||||||
|
@ -169,10 +172,13 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
await this.mutes.updateExpiryTime(user.id, muteTime);
|
await this.mutes.updateExpiryTime(user.id, muteTime);
|
||||||
} else {
|
} else {
|
||||||
await this.mutes.addMute(user.id, muteTime);
|
await this.mutes.addMute(user.id, muteTime);
|
||||||
|
}
|
||||||
|
|
||||||
// If it's a new mute, attempt to message the user
|
const template = existingMute
|
||||||
const config = this.getMatchingConfig({ member, userId });
|
? config.update_mute_message
|
||||||
const template = muteTime ? config.timed_mute_message : config.mute_message;
|
: muteTime
|
||||||
|
? config.timed_mute_message
|
||||||
|
: config.mute_message;
|
||||||
|
|
||||||
const muteMessage =
|
const muteMessage =
|
||||||
template &&
|
template &&
|
||||||
|
@ -193,7 +199,6 @@ export class MutesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
notifyResult = { status: NotifyUserStatus.Failed };
|
notifyResult = { status: NotifyUserStatus.Failed };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Create/update a case
|
// Create/update a case
|
||||||
const casesPlugin = this.getPlugin<CasesPlugin>("cases");
|
const casesPlugin = this.getPlugin<CasesPlugin>("cases");
|
||||||
|
|
Loading…
Add table
Reference in a new issue