Skip to content

Commit 698247d

Browse files
committed
make modmailUserId optional
Fixes #307
1 parent 89ee1f4 commit 698247d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Commands/MuteCmds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public async Task EditMuteCmd(TextCommandContext ctx,
447447
$"\nMute expires: <t:{TimeHelpers.ToUnixTimestamp(mute.ExpireTime)}:R>";
448448
}
449449

450-
if (reason.ToLower().Contains("modmail"))
450+
if (reason.ToLower().Contains("modmail") && Program.cfgjson.ModmailUserId != 0)
451451
{
452452
dmContent += $"\n{Program.cfgjson.Emoji.Information} When contacting <@{Program.cfgjson.ModmailUserId}>, make sure to **enable DMs** from the server to allow your message to go through.";
453453
}

Events/DirectMessageEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static async void DirectMessageEventHandler(DiscordMessage message)
1919
if ((DateTime.UtcNow - msgBefore.CreationTimestamp.DateTime).TotalHours < Program.cfgjson.DmAutoresponseTimeLimit)
2020
{
2121
// Make sure the message before the current one is from the bot and is a warn/mute DM & respond
22-
if (msgBefore.Author.Id == Program.discord.CurrentUser.Id &&
22+
if (msgBefore.Author.Id == Program.discord.CurrentUser.Id && Program.cfgjson.ModmailUserId != 0 &&
2323
(msgBefore.Content.Contains("You were warned") ||
2424
msgBefore.Content.Contains("You have been muted") ||
2525
msgBefore.Content.Contains("You were automatically warned") ||

Helpers/MuteHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public static (int MuteHours, int WarnsSinceThreshold) GetHoursToMuteFor(Diction
193193
}
194194
}
195195

196-
if (reason.ToLower().Contains("modmail"))
196+
if (reason.ToLower().Contains("modmail") && Program.cfgjson.ModmailUserId != 0)
197197
{
198198
dmContent += $"\n{Program.cfgjson.Emoji.Information} When contacting <@{Program.cfgjson.ModmailUserId}>, make sure to **enable DMs** from the server to allow your message to go through.";
199199
}

Types/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public class ConfigJson
111111
public string SecondaryAutoDehoistCharacters { get; private set; }
112112

113113
[JsonProperty("modmailUserId")]
114-
public ulong ModmailUserId { get; private set; }
114+
public ulong ModmailUserId { get; private set; } = 0;
115115

116116
[JsonProperty("announcementRoles")]
117117
public Dictionary<string, ulong> AnnouncementRoles { get; private set; }

0 commit comments

Comments
 (0)