mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Gambling moved to a separate project. Project builds
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
#nullable disable
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NadekoBot.Modules.Permissions;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 1)]
|
||||
public readonly struct CleverBotResponseStr
|
||||
{
|
||||
public const string CLEVERBOT_RESPONSE = "cleverbot:response";
|
||||
}
|
@@ -7,7 +7,8 @@ public static class PermissionExtensions
|
||||
{
|
||||
public static bool CheckPermissions(
|
||||
this IEnumerable<Permissionv2> permsEnumerable,
|
||||
IUserMessage message,
|
||||
IUser user,
|
||||
IMessageChannel message,
|
||||
string commandName,
|
||||
string moduleName,
|
||||
out int permIndex)
|
||||
@@ -18,7 +19,7 @@ public static class PermissionExtensions
|
||||
{
|
||||
var perm = perms[i];
|
||||
|
||||
var result = perm.CheckPermission(message, commandName, moduleName);
|
||||
var result = perm.CheckPermission(user, message, commandName, moduleName);
|
||||
|
||||
if (result is null)
|
||||
continue;
|
||||
@@ -35,7 +36,8 @@ public static class PermissionExtensions
|
||||
//false = applicable, not allowed
|
||||
public static bool? CheckPermission(
|
||||
this Permissionv2 perm,
|
||||
IUserMessage message,
|
||||
IUser user,
|
||||
IMessageChannel channel,
|
||||
string commandName,
|
||||
string moduleName)
|
||||
{
|
||||
@@ -46,16 +48,16 @@ public static class PermissionExtensions
|
||||
|| perm.SecondaryTarget == SecondaryPermissionType.AllModules))
|
||||
return null;
|
||||
|
||||
var guildUser = message.Author as IGuildUser;
|
||||
var guildUser = user as IGuildUser;
|
||||
|
||||
switch (perm.PrimaryTarget)
|
||||
{
|
||||
case PrimaryPermissionType.User:
|
||||
if (perm.PrimaryTargetId == message.Author.Id)
|
||||
if (perm.PrimaryTargetId == user.Id)
|
||||
return perm.State;
|
||||
break;
|
||||
case PrimaryPermissionType.Channel:
|
||||
if (perm.PrimaryTargetId == message.Channel.Id)
|
||||
if (perm.PrimaryTargetId == channel.Id)
|
||||
return perm.State;
|
||||
break;
|
||||
case PrimaryPermissionType.Role:
|
||||
|
@@ -108,7 +108,8 @@ public class PermissionService : IExecPreCommand, INService
|
||||
var resetCommand = commandName == "resetperms";
|
||||
|
||||
var pc = GetCacheFor(guild.Id);
|
||||
if (!resetCommand && !pc.Permissions.CheckPermissions(msg, commandName, moduleName, out var index))
|
||||
if (!resetCommand
|
||||
&& !pc.Permissions.CheckPermissions(msg.Author, msg.Channel, commandName, moduleName, out var index))
|
||||
{
|
||||
if (pc.Verbose)
|
||||
{
|
||||
|
Reference in New Issue
Block a user