Skip to content

Commit

Permalink
Merge pull request #578 from zaanposni/release/3.5.0
Browse files Browse the repository at this point in the history
Release/3.5.0
  • Loading branch information
zaanposni authored Sep 8, 2023
2 parents dbc22b3 + f35512e commit 8d98c0a
Show file tree
Hide file tree
Showing 83 changed files with 4,938 additions and 1,384 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![LatestVersion](https://maszindex.zaanposni.com/api/v1/views/version/current/readme?)
[![https://github.com/users/zaanposni/packages/container/package/masz_backend](https://img.shields.io/badge/using-docker-blue?style=for-the-badge)](https://github.com/users/zaanposni/packages/container/package/masz_backend)
[![https://discord.gg/5zjpzw6h3S](https://img.shields.io/discord/779262870016884756?logo=discord&style=for-the-badge)](https://discord.gg/5zjpzw6h3S)
[![SupportedLanguages](https://img.shields.io/badge/translated-7%20languages-brightgreen?style=for-the-badge)](https://github.com/zaanposni/discord-masz/blob/master/translations/supported_languages.json)
[![SupportedLanguages](https://img.shields.io/badge/translated-8%20languages-brightgreen?style=for-the-badge)](https://github.com/zaanposni/discord-masz/blob/master/translations/supported_languages.json)

**Infractions and managed (temporary) punishments** - to moderate your server\
**Quicksearch** - to reliably search for any infractions or notes a user has\
Expand All @@ -13,6 +13,11 @@
**A website and a discord bot** - to use MASZ\
**Full API and plugin support** - for custom scripts and automations

## 🤝 Maintainers

This project is stable to use. However, it is no longer actively maintained by me.\
**If you want to become a maintainer**, please contact me via [Mail](mailto:masz@zaanposni.com) or [Discord](https://discord.gg/5zjpzw6h3S).

## 👀 Preview

![dashboard preview](/docs/dashboard.png)
Expand Down
2 changes: 1 addition & 1 deletion backend/MASZ/AutoModeration/InviteCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace MASZ.AutoModeration
{
public static class InviteChecker
{
private static readonly Regex _inviteRegex = new(@"(https?:\/\/)?(www\.)?(discord(app)?\.(gg|io|me|li|com)(\/invite)?)\/(?![a-z]+\/)([^\?\s]+)(\?event=([^\s]+))?");
private static readonly Regex _inviteRegex = new(@"(https?:\/\/)?(www\.)?(discord(app)?\.(gg|io|me|li|com)(\/invite)?)\/(?![a-z]+\/)([^\?\s\)]+)(\?event=([^\s]+))?");
//private static readonly Regex _discordResourcesWhitelist = new(@"(https?:\/\/)?(www\.)?(discord(app)?\.com\/(download|nitro|company|careers|branding|newsroom|college|safetycenter|blog|build|streamkit|creators|terms|privacy|guidelines|acknowledgements|licenses|moderation))\/?");
private static readonly Regex _discordResourcesWhitelist = new(@"(https?:\/\/)?(www\.)?(discord(app)?\.com\/)(?:(?!invite))");
public static async Task<bool> Check(IMessage message, AutoModerationConfig config, IDiscordClient client)
Expand Down
4 changes: 2 additions & 2 deletions backend/MASZ/Commands/AntiraidCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private async Task<int> IterateAndDeleteChannel(ITextChannel channel, IUser curr
if (toDelete.Count >= 2)
{
RequestOptions options = new();
options.AuditLogReason = $"Bulkdelete by {currentActor.Username}#{currentActor.Discriminator} ({currentActor.Id}).";
options.AuditLogReason = $"Bulkdelete by {currentActor.Username} ({currentActor.Id}).";

await channel.DeleteMessagesAsync(toDelete, options);
toDelete.Clear();
Expand Down Expand Up @@ -120,7 +120,7 @@ private async Task<int> IterateAndDeleteChannel(ITextChannel channel, IUser curr
if (toDelete.Count >= 2)
{
RequestOptions options = new();
options.AuditLogReason = $"Bulkdelete by {currentActor.Username}#{currentActor.Discriminator} ({currentActor.Id}).";
options.AuditLogReason = $"Bulkdelete by {currentActor.Username} ({currentActor.Id}).";

await channel.DeleteMessagesAsync(toDelete, options);
toDelete.Clear();
Expand Down
4 changes: 2 additions & 2 deletions backend/MASZ/Commands/CleanupCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private async Task<int> IterateAndDeleteChannels(ITextChannel channel, int limit
if (toDelete.Count >= 2)
{
RequestOptions options = new();
options.AuditLogReason = $"Bulkdelete by {currentActor.Username}#{currentActor.Discriminator} ({currentActor.Id}).";
options.AuditLogReason = $"Bulkdelete by {currentActor.Username} ({currentActor.Id}).";

await channel.DeleteMessagesAsync(toDelete, options);
toDelete.Clear();
Expand Down Expand Up @@ -161,7 +161,7 @@ private async Task<int> IterateAndDeleteChannels(ITextChannel channel, int limit
if (toDelete.Count >= 2)
{
RequestOptions options = new();
options.AuditLogReason = $"Bulkdelete by {currentActor.Username}#{currentActor.Discriminator} ({currentActor.Id}).";
options.AuditLogReason = $"Bulkdelete by {currentActor.Username} ({currentActor.Id}).";

await channel.DeleteMessagesAsync(toDelete, options);
toDelete.Clear();
Expand Down
1 change: 0 additions & 1 deletion backend/MASZ/Commands/CreateEvidenceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public async Task CreateEvidence(IMessage message)
UserId = reportedUser.Id,
Username = reportedUser.Username,
Nickname = reportedUser.Nickname,
Discriminator = reportedUser.Discriminator,
ModId = Context.User.Id
};

Expand Down
2 changes: 1 addition & 1 deletion backend/MASZ/Commands/StatusCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task Status()
var user = item.GetCurrentUser();
if (user != null)
{
loggedInString.AppendLine($"{user.Username}#{user.Discriminator}");
loggedInString.AppendLine($"{user.Username}");
loggedInCount++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion backend/MASZ/Commands/TrackCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async Task Track([Summary("invite", "Either enter the invite code or the
if (invitees.ContainsKey(invite.JoinedUserId))
{
IUser user = invitees[invite.JoinedUserId];
usedBy.Append($"`{user.Username}#{user.Discriminator}` ");
usedBy.Append($"`{user.Username}` ");
}
usedBy.AppendLine($"`{invite.JoinedUserId}` - {invite.JoinedAt.ToDiscordTS()}");
}
Expand Down
2 changes: 1 addition & 1 deletion backend/MASZ/Controllers/api/v1/AdminStatsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task<IActionResult> Status()
}
else
{
currentLogins.Add($"{user.Username}#{user.Discriminator}");
currentLogins.Add($"{user.Username}");
}
}
catch (Exception e)
Expand Down
1 change: 0 additions & 1 deletion backend/MASZ/Controllers/api/v1/AppealController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ public async Task<IActionResult> CreateAppeal([FromRoute] ulong guildId, [FromBo
Appeal appeal = new();
appeal.UserId = currentUser.Id;
appeal.Username = currentUser.Username;
appeal.Discriminator = currentUser.Discriminator;
appeal.Mail = string.Empty;
appeal.GuildId = guildId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public IActionResult LanguageEnum([FromQuery] Language? language = null)
EnumDto.Create((int) Language.es, _translator.T().Enum(Language.es)),
EnumDto.Create((int) Language.it, _translator.T().Enum(Language.it)),
EnumDto.Create((int) Language.at, _translator.T().Enum(Language.at)),
EnumDto.Create((int) Language.ru, _translator.T().Enum(Language.ru))
EnumDto.Create((int) Language.ru, _translator.T().Enum(Language.ru)),
EnumDto.Create((int) Language.nl, _translator.T().Enum(Language.nl))
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public async Task<IActionResult> CreateEvidence([FromRoute] ulong guildId, [From
ReportedContent = message.Content,
UserId = message.Author.Id,
Username = message.Author.Username,
Discriminator = message.Author.Discriminator,
Nickname = nickname,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ await _discordAPI.FetchUserInfo(c.UserId, CacheBehavior.OnlyCache)
Contains(t.ModCase.Description, search.CustomTextFilter) ||
Contains(t.ModCase.GetPunishment(_translator), search.CustomTextFilter) ||
Contains(t.ModCase.Username, search.CustomTextFilter) ||
Contains(t.ModCase.Discriminator, search.CustomTextFilter) ||
Contains(t.ModCase.Nickname, search.CustomTextFilter) ||
Contains(t.ModCase.UserId, search.CustomTextFilter) ||
Contains(t.ModCase.ModId, search.CustomTextFilter) ||
Expand Down Expand Up @@ -209,7 +208,7 @@ private static bool Contains(DiscordUserView obj, string search)
{
return false;
}
return Contains(obj.Username, search) || Contains(obj.Discriminator, search);
return Contains(obj.Username, search);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ await _discordAPI.FetchUserInfo(e.ModId, CacheBehavior.OnlyCache)
table = table.Where(t =>
Contains(t.VerifiedEvidence.ReportedContent, search.CustomTextFilter) ||
Contains(t.VerifiedEvidence.UserId, search.CustomTextFilter) ||
Contains(t.VerifiedEvidence.Username + "#" + t.VerifiedEvidence.Discriminator, search.CustomTextFilter) ||
Contains(t.VerifiedEvidence.Username, search.CustomTextFilter) ||
Contains(t.VerifiedEvidence.Nickname, search.CustomTextFilter) ||
Contains(t.VerifiedEvidence.ModId, search.CustomTextFilter) ||
Contains(t.VerifiedEvidence.ChannelId, search.CustomTextFilter) ||
Expand Down Expand Up @@ -124,7 +124,7 @@ private static bool Contains(DiscordUserView obj, string search)
{
return false;
}
return Contains(obj.Username, search) || Contains(obj.Discriminator, search);
return Contains(obj.Username, search);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class AutoModerationEventForCreateDto
public AutoModerationType AutoModerationType { get; set; }
public string Username { get; set; }
public string Nickname { get; set; }
public string Discriminator { get; set; }
public string MessageId { get; set; }
public string ChannelId { get; set; }
public string MessageContent { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion backend/MASZ/Enums/LanguageEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum Language
es,
it,
at,
ru
ru,
nl,
}
}
6 changes: 3 additions & 3 deletions backend/MASZ/Exceptions/EmbedCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public static async Task<EmbedBuilder> CreateInternalAutomodEmbed(this AutoModer
{
embed.AddField(
translator.T().MessageContent(),
autoModerationEvent.MessageContent,
autoModerationEvent.MessageContent.Truncate(1000),
false
);
}
Expand Down Expand Up @@ -528,7 +528,7 @@ public static async Task<EmbedBuilder> CreateEmbedForNewAppeal(this Appeal appea
embed.WithThumbnailUrl(actor.GetAvatarOrDefaultUrl());
}
embed.Description = translator.T().NotificationAppealsCreate(appeal.UserId);
embed.Title = $"**{translator.T().NotificationAppealsAppeal().ToUpper()}** - {actor.Username}#{actor.Discriminator}";
embed.Title = $"**{translator.T().NotificationAppealsAppeal().ToUpper()}** - {actor.Username}";

// Footer
embed.WithFooter($"UserId: {appeal.UserId} | AppealId: {appeal.Id}");
Expand All @@ -549,7 +549,7 @@ public static async Task<EmbedBuilder> CreateEmbedForUpdatedAppeal(this Appeal a
embed.WithThumbnailUrl(actor.GetAvatarOrDefaultUrl());
}
embed.Description = translator.T().NotificationAppealsUpdate(appeal.UserId, actor.Id);
embed.Title = $"**{translator.T().NotificationAppealsAppeal().ToUpper()}** - {user?.Username ?? appeal.Username}#{user?.Discriminator ?? appeal.Discriminator}";
embed.Title = $"**{translator.T().NotificationAppealsAppeal().ToUpper()}** - {user?.Username ?? appeal.Username}";

embed.AddField(translator.T().NotificationAppealsStatus(), translator.T().Enum(appeal.Status), false);

Expand Down
2 changes: 1 addition & 1 deletion backend/MASZ/MASZ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.Discord" Version="6.0.1" />
<PackageReference Include="AspNetCoreRateLimit" Version="4.0.1" />
<PackageReference Include="Discord.Net" Version="3.8.1" />
<PackageReference Include="Discord.Net" Version="3.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.1" />
Expand Down
Loading

0 comments on commit 8d98c0a

Please sign in to comment.