Fix synchronous async warning CheckPerms
This commit is contained in:
parent
18c7b2c961
commit
51f153f400
@ -40,7 +40,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
await LodestoneHelp();
|
await LodestoneHelp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (((cmd.ToLower() == "link") || (cmd.ToLower() == "l") || (cmd.ToLower() == "attach") || (cmd.ToLower() == "claim") || (cmd.ToLower() == "take")) && (await CheckPermissions.CheckPerms(Context, "lodestone.link", "User")))
|
else if (((cmd.ToLower() == "link") || (cmd.ToLower() == "l") || (cmd.ToLower() == "attach") || (cmd.ToLower() == "claim") || (cmd.ToLower() == "take")) && (CheckPermissions.CheckPerms(Context, "lodestone.link", "User")))
|
||||||
{
|
{
|
||||||
if(args.Length >= 1)
|
if(args.Length >= 1)
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
sb.AppendLine("To get Character Info:");
|
sb.AppendLine("To get Character Info:");
|
||||||
sb.AppendLine($"By Id: {ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}lodestone character 9231394073691143535");
|
sb.AppendLine($"By Id: {ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}lodestone character 9231394073691143535");
|
||||||
sb.AppendLine($"By Name: {ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}lodestone character Siren Luna Kaisar");
|
sb.AppendLine($"By Name: {ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}lodestone character Siren Luna Kaisar");
|
||||||
if (await CheckPermissions.CheckPerms(Context, "lodestone.link", "User"))
|
if (CheckPermissions.CheckPerms(Context, "lodestone.link", "User"))
|
||||||
{
|
{
|
||||||
sb.AppendLine("To Link your Character:");
|
sb.AppendLine("To Link your Character:");
|
||||||
sb.AppendLine($"By Id: {ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}lodestone link 9231394073691143535");
|
sb.AppendLine($"By Id: {ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}lodestone link 9231394073691143535");
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
{
|
{
|
||||||
if(Amount != 0)
|
if(Amount != 0)
|
||||||
{
|
{
|
||||||
Boolean adminAccess = await CheckPermissions.CheckPerms(Context, "points.add", "Admin");
|
Boolean adminAccess = CheckPermissions.CheckPerms(Context, "points.add", "Admin");
|
||||||
await AddPoints(userMention, Amount, adminAccess);
|
await AddPoints(userMention, Amount, adminAccess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -41,7 +41,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
}
|
}
|
||||||
else if ((cmd.ToLower() == "remove") || (cmd.ToLower() == "rem") || (cmd.ToLower() == "take") || (cmd.ToLower() == "-"))
|
else if ((cmd.ToLower() == "remove") || (cmd.ToLower() == "rem") || (cmd.ToLower() == "take") || (cmd.ToLower() == "-"))
|
||||||
{
|
{
|
||||||
if((Amount != 0) && (await CheckPermissions.CheckPerms(Context, "points.remove", "Admin")))
|
if((Amount != 0) && (CheckPermissions.CheckPerms(Context, "points.remove", "Admin")))
|
||||||
{
|
{
|
||||||
await RemPoints(userMention, Amount);
|
await RemPoints(userMention, Amount);
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
}
|
}
|
||||||
else if ((cmd.ToLower() == "delete") || (cmd.ToLower() == "del"))
|
else if ((cmd.ToLower() == "delete") || (cmd.ToLower() == "del"))
|
||||||
{
|
{
|
||||||
if((Amount == 0) && (await CheckPermissions.CheckPerms(Context, "points.remove", "Admin")))
|
if((Amount == 0) && (CheckPermissions.CheckPerms(Context, "points.remove", "Admin")))
|
||||||
{
|
{
|
||||||
await DelPoints(userMention);
|
await DelPoints(userMention);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
{
|
{
|
||||||
if ((cmd.ToLower() == "add") || (cmd.ToLower() == "+") || (cmd.ToLower() == "give"))
|
if ((cmd.ToLower() == "add") || (cmd.ToLower() == "+") || (cmd.ToLower() == "give"))
|
||||||
{
|
{
|
||||||
if((Amount != 0) && (await CheckPermissions.CheckPerms(Context, "raffle.add", "Admin")))
|
if((Amount != 0) && (CheckPermissions.CheckPerms(Context, "raffle.add", "Admin")))
|
||||||
{
|
{
|
||||||
await AddRaffle(userMention, Amount, true);
|
await AddRaffle(userMention, Amount, true);
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
}
|
}
|
||||||
else if (cmd.ToLower() == "pick")
|
else if (cmd.ToLower() == "pick")
|
||||||
{
|
{
|
||||||
if(await CheckPermissions.CheckPerms(Context, "raffle.pick", "Admin"))
|
if(CheckPermissions.CheckPerms(Context, "raffle.pick", "Admin"))
|
||||||
{
|
{
|
||||||
await PickRaffle();
|
await PickRaffle();
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
}
|
}
|
||||||
else if ((cmd.ToLower() == "remove") || (cmd.ToLower() == "rem") || (cmd.ToLower() == "take") || (cmd.ToLower() == "-"))
|
else if ((cmd.ToLower() == "remove") || (cmd.ToLower() == "rem") || (cmd.ToLower() == "take") || (cmd.ToLower() == "-"))
|
||||||
{
|
{
|
||||||
if((Amount != 0) && (await CheckPermissions.CheckPerms(Context, "raffle.remove", "Admin")))
|
if((Amount != 0) && (CheckPermissions.CheckPerms(Context, "raffle.remove", "Admin")))
|
||||||
{
|
{
|
||||||
await RemRaffle(userMention, Amount);
|
await RemRaffle(userMention, Amount);
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
}
|
}
|
||||||
else if ((cmd.ToLower() == "delete") || (cmd.ToLower() == "del"))
|
else if ((cmd.ToLower() == "delete") || (cmd.ToLower() == "del"))
|
||||||
{
|
{
|
||||||
if((Amount == 0) && (await CheckPermissions.CheckPerms(Context, "raffle.remove", "Admin")))
|
if((Amount == 0) && (CheckPermissions.CheckPerms(Context, "raffle.remove", "Admin")))
|
||||||
{
|
{
|
||||||
await DelRaffle(userMention);
|
await DelRaffle(userMention);
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
{
|
{
|
||||||
await TotalRaffle();
|
await TotalRaffle();
|
||||||
}
|
}
|
||||||
else if ((cmd.ToLower() == "clear") && (await CheckPermissions.CheckPerms(Context, "raffle.clear", "Admin")))
|
else if ((cmd.ToLower() == "clear") && (CheckPermissions.CheckPerms(Context, "raffle.clear", "Admin")))
|
||||||
{
|
{
|
||||||
await ClearRaffle(userMention);
|
await ClearRaffle(userMention);
|
||||||
}
|
}
|
||||||
@ -104,9 +104,9 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle buy <amount>");
|
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle buy <amount>");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
sb.AppendLine("Moderation commands:");
|
sb.AppendLine("Moderation commands:");
|
||||||
if(await CheckPermissions.CheckPerms(Context, "raffle.add", "Admin"))
|
if(CheckPermissions.CheckPerms(Context, "raffle.add", "Admin"))
|
||||||
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle add <discord mention> <amount>");
|
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle add <discord mention> <amount>");
|
||||||
if(await CheckPermissions.CheckPerms(Context, "raffle.remove", "Admin"))
|
if(CheckPermissions.CheckPerms(Context, "raffle.remove", "Admin"))
|
||||||
{
|
{
|
||||||
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle remove <discord mention> <amount>");
|
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle remove <discord mention> <amount>");
|
||||||
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle delete <discord mention>");
|
sb.AppendLine($"{ConfigurationRepository.GetValue<string>("Discord:Prefix", Context.Guild.Id, "!")}raffle delete <discord mention>");
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace ChaosBot.Services
|
|||||||
{
|
{
|
||||||
private static ILogger _logger = Program.Logger;
|
private static ILogger _logger = Program.Logger;
|
||||||
|
|
||||||
public static async Task<Boolean> CheckPerms(ICommandContext context, string command, string defaultRole = "User")
|
public static Boolean CheckPerms(ICommandContext context, string command, string defaultRole = "User")
|
||||||
{
|
{
|
||||||
// Debug information
|
// Debug information
|
||||||
_logger.Trace($"CheckCommandPerm.CheckPermissionsAsync|Checking permissions for command: {command}");
|
_logger.Trace($"CheckCommandPerm.CheckPermissionsAsync|Checking permissions for command: {command}");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user