Remove the ability the lookup username history for moderators
This commit is contained in:
parent
56f788878a
commit
619f63067c
4 changed files with 3 additions and 44 deletions
|
@ -1,12 +1,9 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using Geekbot.net.Lib.CommandPreconditions;
|
||||
using Geekbot.net.Lib.ErrorHandling;
|
||||
using Geekbot.net.Lib.UserRepository;
|
||||
|
||||
namespace Geekbot.net.Commands.Admin
|
||||
{
|
||||
|
@ -17,15 +14,11 @@ namespace Geekbot.net.Commands.Admin
|
|||
[DisableInDirectMessage]
|
||||
public class Mod : ModuleBase
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
public Mod(IUserRepository userRepositry, IErrorHandler errorHandler, DiscordSocketClient client)
|
||||
public Mod(IErrorHandler errorHandler)
|
||||
{
|
||||
_userRepository = userRepositry;
|
||||
_errorHandler = errorHandler;
|
||||
_client = client;
|
||||
}
|
||||
|
||||
[Command("namehistory", RunMode = RunMode.Async)]
|
||||
|
@ -34,23 +27,11 @@ namespace Geekbot.net.Commands.Admin
|
|||
{
|
||||
try
|
||||
{
|
||||
var userRepo = _userRepository.Get(user.Id);
|
||||
if (userRepo?.UsedNames != null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($":bust_in_silhouette: {user.Username} has been known as:");
|
||||
foreach (var name in userRepo.UsedNames) sb.AppendLine($"- `{name.Name}`");
|
||||
await ReplyAsync(sb.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyAsync($"No name changes found for {user.Username}");
|
||||
}
|
||||
await Context.Channel.SendMessageAsync("This command has been removed due to low usage and excessively high database usage");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await _errorHandler.HandleCommandException(e, Context,
|
||||
"I don't have enough permissions do that");
|
||||
await _errorHandler.HandleCommandException(e, Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,5 @@ namespace Geekbot.net.Database.Models
|
|||
public bool IsBot { get; set; }
|
||||
|
||||
public DateTimeOffset Joined { get; set; }
|
||||
|
||||
public List<UserUsedNamesModel> UsedNames { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Geekbot.net.Database.Models
|
||||
{
|
||||
public class UserUsedNamesModel
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public DateTimeOffset FirstSeen { get; set; }
|
||||
}
|
||||
}
|
|
@ -37,11 +37,6 @@ namespace Geekbot.net.Lib.UserRepository
|
|||
savedUser.AvatarUrl = user.GetAvatarUrl() ?? "";
|
||||
savedUser.IsBot = user.IsBot;
|
||||
savedUser.Joined = user.CreatedAt;
|
||||
if (savedUser.UsedNames == null) savedUser.UsedNames = new List<UserUsedNamesModel>();
|
||||
if (!savedUser.UsedNames.Any(e => e.Name.Equals(user.Username)))
|
||||
{
|
||||
savedUser.UsedNames.Add(new UserUsedNamesModel { Name = user.Username, FirstSeen = DateTimeOffset.Now });
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue