Skip to content

Commit

Permalink
i did far too much stuff in this commit (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
uwx committed Feb 23, 2018
1 parent b1d901b commit 6ba1c37
Show file tree
Hide file tree
Showing 39 changed files with 426 additions and 445 deletions.
22 changes: 9 additions & 13 deletions ModCore/Api/Perspective.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using Newtonsoft.Json;
using System.IO;
using ModCore.Entities;
using System;
using System.Linq;

namespace ModCore.Api
{
Expand Down Expand Up @@ -41,9 +37,9 @@ public Perspective(string token)

public async Task<PerspectiveAnalysisResponse> RequestAnalysis(string message)
{
var RequestPayload = new PerspectiveAnalysisRequest()
var RequestPayload = new PerspectiveAnalysisRequest
{
Comment = new PerspectiveComment()
Comment = new PerspectiveComment
{
Text = message
}
Expand All @@ -67,13 +63,13 @@ public class PerspectiveAnalysisRequest
public PerspectiveContext Context = new PerspectiveContext();

[JsonProperty("requestedAttributes")]
public Dictionary<string, PerspectiveAttributes> RequestedAttributes = new Dictionary<string, PerspectiveAttributes>()
public Dictionary<string, PerspectiveAttributes> RequestedAttributes = new Dictionary<string, PerspectiveAttributes>
{
{ "TOXICITY", new PerspectiveAttributes(){ ScoreTreshold = null, ScoreType = null } }
{ "TOXICITY", new PerspectiveAttributes { ScoreTreshold = null, ScoreType = null } }
};

[JsonProperty("languages")]
public List<string> Languages = new List<string>() { "en" };
public List<string> Languages = new List<string> { "en" };

[JsonProperty("doNotStore")]
public bool DoNotStore = true;
Expand Down Expand Up @@ -138,17 +134,17 @@ public class AttributeScore
public class SpanScore
{
[JsonProperty("begin")]
public int Begin = 0;
public int Begin;
[JsonProperty("end")]
public int End = 0;
public int End;
[JsonProperty("score")]
public Score Score;
}

public class Score
{
[JsonProperty("value")]
public float Value = 0.0f;
public float Value;

[JsonProperty("type")]
public string Type = "";
Expand Down
149 changes: 64 additions & 85 deletions ModCore/Commands/Config.cs

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions ModCore/Commands/Info.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System;
using System.Globalization;
using System.Text;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.Interactivity;
using ModCore.Entities;
using DSharpPlus.Entities;
using System.Text;
using DSharpPlus;
using ModCore.Logic;

namespace ModCore.Commands
{
Expand Down Expand Up @@ -57,14 +58,14 @@ public async Task UserInfoAsync(CommandContext ctx, [Description("Member to get

embed.WithFooter($"{ctx.Guild.Name} / #{ctx.Channel.Name} / {DateTime.Now}");

await ctx.RespondAsync("", false, embed: embed);
await ctx.ElevatedRespondAsync(embed: embed);
await ctx.LogActionAsync();
}

[Command("guild"), Aliases("g"), Description("Returns information about this guild.")]
public async Task GuildInfoAsync(CommandContext ctx)
{
await ctx.RespondAsync("The following embed might flood this channel. Do you want to proceed?");
await ctx.SafeRespondAsync("The following embed might flood this channel. Do you want to proceed?");
var m = await Interactivity.WaitForMessageAsync(x => x.Content.ToLower() == "yes" || x.Content.ToLower() == "no");
if (m?.Message?.Content == "yes")
{
Expand Down Expand Up @@ -130,13 +131,13 @@ public async Task GuildInfoAsync(CommandContext ctx)
$"MFA Level: {g.MfaLevel}.\n" +
$"Verification Level: {g.VerificationLevel}");

await ctx.RespondAsync("", false, embed: embed);
await ctx.ElevatedRespondAsync(embed: embed);
#endregion
}
else
{
#region no or timeout
await ctx.RespondAsync("Okay, I'm not sending the embed.");
await ctx.SafeRespondAsync("Okay, I'm not sending the embed.");
#endregion
}
await ctx.LogActionAsync();
Expand All @@ -152,7 +153,7 @@ public async Task RoleInfoAsync(CommandContext ctx, [Description("Role to get in
.AddField("Data", $"Mentionable: {(role.IsMentionable ? "yes" : "no")}.\nHoisted: {(role.IsHoisted ? "yes" : "no")}.\nManaged: {(role.IsManaged ? "yes" : "no")}.")
.WithColor(role.Color);

await ctx.RespondAsync(embed: embed);
await ctx.ElevatedRespondAsync(embed: embed);
await ctx.LogActionAsync();
}

Expand Down Expand Up @@ -195,7 +196,7 @@ public async Task ChannelInfoAsync(CommandContext ctx, [Description("Channel to
embed.AddField("Misc", $"NSFW: {(channel.IsNSFW ? "yes" : "no")}\n" +
$"{(channel.Type == ChannelType.Text ? $"Last message ID: {channel.LastMessageId}" : "")}");

await ctx.RespondAsync(embed: embed);
await ctx.ElevatedRespondAsync(embed: embed);
await ctx.LogActionAsync();
}
}
Expand Down
Loading

0 comments on commit 6ba1c37

Please sign in to comment.