Skip to content

Commit 6cc78d9

Browse files
Autowarn for CTS pings outside of tech support channels
1 parent bb493ce commit 6cc78d9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Events/MessageEvent.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,30 @@ Program.cfgjson.GitListDirectory is not null
11191119
#endregion
11201120
}
11211121
#endregion
1122+
1123+
#region CTS ping autowarn
1124+
if (message.Content.Contains(Program.cfgjson.CommunityTechSupportRoleID.ToString())
1125+
&& channel.Id != Program.cfgjson.TechSupportChannel
1126+
&& channel.Parent.Id != Program.cfgjson.TechSupportChannel
1127+
&& channel.Id != Program.cfgjson.SupportForumId
1128+
&& channel.Parent.Id != Program.cfgjson.SupportForumId)
1129+
{
1130+
string reason = "Mentioned Community Tech Support outside of tech support channels";
1131+
1132+
if (await Program.redis.SetContainsAsync("ctsPingPardons", message.Author.Id))
1133+
{
1134+
var msg = await channel.SendMessageAsync($"{Program.cfgjson.Emoji.Denied} {message.Author.Mention} was automatically warned: **{reason.Replace("`", "\\`").Replace("*", "\\*")}**\n"
1135+
+ "Please keep requests for tech support inside the tech support channels to avoid punishment.");
1136+
await WarningHelpers.GiveWarningAsync(message.Author, Program.discord.CurrentUser, reason, msg, channel, " automatically ");
1137+
}
1138+
else // also false when set does not exist
1139+
{
1140+
await Program.redis.SetAddAsync("ctsPingPardons", message.Author.Id);
1141+
await channel.SendMessageAsync($"{Program.cfgjson.Emoji.Information} {message.Author.Mention}, you mentioned Community Tech Support outside of a tech support channel.\n"
1142+
+ "Please keep requests for tech support inside the tech support channels to avoid further punishment.");
1143+
}
1144+
}
1145+
#endregion
11221146

11231147
if (!limitFilters)
11241148
{

0 commit comments

Comments
 (0)