utility done
This commit is contained in:
parent
14876012f5
commit
091ea0fd32
@ -10,9 +10,11 @@ using System.Threading.Tasks;
|
||||
namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class CalcCommands : ModuleBase
|
||||
{
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Calculate([Remainder] string expression)
|
||||
{
|
||||
var expr = new NCalc.Expression(expression, NCalc.EvaluateOptions.IgnoreCase);
|
||||
@ -26,16 +28,18 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
private static void Expr_EvaluateParameter(string name, NCalc.ParameterArgs args)
|
||||
{
|
||||
switch (name.ToLowerInvariant()) {
|
||||
case "pi": args.Result= Math.PI;
|
||||
switch (name.ToLowerInvariant())
|
||||
{
|
||||
case "pi":
|
||||
args.Result = Math.PI;
|
||||
break;
|
||||
case "e": args.Result = Math.E;
|
||||
case "e":
|
||||
args.Result = Math.E;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task CalcOps()
|
||||
{
|
||||
var selection = typeof(Math).GetTypeInfo().GetMethods().Except(typeof(object).GetTypeInfo().GetMethods()).Distinct(new MethodInfoEqualityComparer()).Select(x =>
|
||||
@ -63,3 +67,4 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,6 +10,9 @@ using System.Threading.Tasks;
|
||||
namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class InfoCommands : ModuleBase
|
||||
{
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@ -82,7 +85,8 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
var embed = new EmbedBuilder()
|
||||
.AddField(fb => fb.WithName("**Name**").WithValue($"**{user.Username}**#{user.Discriminator}").WithIsInline(true));
|
||||
if (!string.IsNullOrWhiteSpace(user.Nickname)) {
|
||||
if (!string.IsNullOrWhiteSpace(user.Nickname))
|
||||
{
|
||||
embed.AddField(fb => fb.WithName("**Nickname**").WithValue(user.Nickname).WithIsInline(true));
|
||||
}
|
||||
embed.AddField(fb => fb.WithName("**ID**").WithValue(user.Id.ToString()).WithIsInline(true))
|
||||
@ -96,3 +100,4 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,9 @@ using System.Threading.Tasks;
|
||||
namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class QuoteCommands : ModuleBase
|
||||
{
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@ -133,3 +136,4 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ namespace NadekoBot.Modules.Utility
|
||||
[Group]
|
||||
public class UnitConverterCommands : ModuleBase
|
||||
{
|
||||
|
||||
public static List<ConvertUnit> Units { get; set; } = new List<ConvertUnit>();
|
||||
private static Logger _log { get; }
|
||||
private static Timer _timer;
|
||||
@ -64,7 +63,8 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
|
||||
public async Task UpdateCurrency()
|
||||
{try
|
||||
{
|
||||
try
|
||||
{
|
||||
var currencyRates = await UpdateCurrencyRates();
|
||||
var unitTypeString = "currency";
|
||||
@ -95,12 +95,13 @@ namespace NadekoBot.Modules.Utility
|
||||
Units.AddRange(range);
|
||||
_log.Info("Updated Currency");
|
||||
}
|
||||
catch {
|
||||
catch
|
||||
{
|
||||
_log.Warn("Failed updating currency.");
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ConvertList()
|
||||
{
|
||||
var res = Units.GroupBy(x => x.UnitType)
|
||||
|
@ -211,7 +211,7 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
await channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithColor(NadekoBot.OkColor),
|
||||
(embed, g) => embed.AddField(efb => efb.WithName(g.Name)
|
||||
.WithValue($"```css\nID: {g.Id}\nMembers: {(g.GetUsersAsync().GetAwaiter().GetResult()).Count}\nOwnerID: {g.OwnerId} ```")
|
||||
.WithValue($"```css\nID: {g.Id}\nMembers: {g.Users.Count}\nOwnerID: {g.OwnerId} ```")
|
||||
.WithIsInline(false))))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user