public async Task WarnUserSmallSizeAsync(SocketUser user, [Remainder] string reason) { ModerationFunctions.CheckDirectories(Context.Guild); ModerationFunctions.WarnUser(user, 1, reason, Context.Guild.OwnerId + "/Infractions/Discord/" + user.Id); await ReplyAsync(user.Username + " has been warned for " + reason); }
public async Task WarnUserSmallSizeAsync(SocketUser user, [Remainder] string reason) { if (!((SocketGuildUser)Context.User).CanWarn()) { await ReplyAsync("You do not have permission to use this command"); return; } ModerationFunctions.CheckDirectories(Context.Guild); ModerationFunctions.WarnUser(user, 1, reason, Context.Guild.OwnerId + "/Infractions/Games/" + user.Id); await ReplyAsync(user.Username + " has been warned for " + reason); }
public static async Task CheckMessage(SocketMessage message) { var chnl = message.Channel as SocketGuildChannel; var Guild = chnl.Guild; if (Guild != null && Directory.Exists("/home/bob_the_daniel/Data/" + Guild.OwnerId) && !Utilities.HasAdmin(message.Author as SocketGuildUser)) { JsonSerializer serializer = new JsonSerializer(); serializer.NullValueHandling = NullValueHandling.Ignore; List <BadWord> badWords; using (StreamReader sr = new StreamReader(@"/home/bob_the_daniel/Data/" + Guild.OwnerId + "/badwords.json")) using (JsonTextReader reader = new JsonTextReader(sr)) { badWords = serializer.Deserialize <List <BadWord> >(reader); } if (message.Content.Contains("discord.gg/")) { if (!SettingFunctions.LoadModSettings(Guild).invitesAllowed) { ModerationFunctions.WarnUser(message.Author, 0.5f, "Posted Invite", Guild.OwnerId + "/Infractions/Discord/" + message.Author.Id); await message.Channel.SendMessageAsync("warned " + message.Author.Mention + " for posting a discord invite"); Logging.LogDeleted("Bad word removed", message, Guild); await message.DeleteAsync(); return; } } //Guild.OwnerId if (File.Exists("/home/bob_the_daniel/Data/" + Guild.OwnerId + "/badwords.json")) { foreach (BadWord badWord in badWords) { if (message.Content.Contains(badWord.word)) { ModerationFunctions.WarnUser(message.Author, 0.5f, "Bad word", Guild.OwnerId + "/Infractions/Discord/" + message.Author.Id); await message.Channel.SendMessageAsync("warned " + message.Author.Mention + " for bad word"); Logging.LogDeleted("Bad word removed", message, Guild); await message.DeleteAsync(); return; } } } } }
public async Task WarnUserAsync(SocketUser user, float size, [Remainder] string reason) { if (!((SocketGuildUser)Context.User).CanWarn()) { await ReplyAsync("You do not have permission to use this command"); return; } if (size > 999 || size < 0.01) { await ReplyAsync("Why would you need to warn someone with that size?"); return; } ModerationFunctions.CheckDirectories(Context.Guild); ModerationFunctions.WarnUser(user, size, reason, Context.Guild.OwnerId + "/Infractions/Games/" + user.Id); await ReplyAsync(user.Username + " has been warned for " + reason); }