Пример #1
0
        /// <summary> Returns true if the User has permission to execute this command. </summary>
        public bool CanExecute(IBotwinderClient client, Server server, SocketGuildChannel channel, SocketGuildUser user)
        {
            if (client.IsGlobalAdmin(user.Id))
            {
                return(true);
            }

            if (this.IsSupportCommand && client.IsSupportTeam(user.Id))
            {
                return(true);
            }

            //Premium-only commands
            if (this.IsPremiumCommand && !client.IsPremiumSubscriber(user.Id))
            {
                return(false);
            }
            if (this.IsBonusCommand && !client.IsBonusSubscriber(user.Id))
            {
                return(false);
            }
            if (this.IsPremiumServerwideCommand && !client.IsPremiumSubscriber(server.Guild.OwnerId) && !client.IsPremiumPartner(server.Id))
            {
                return(false);
            }

            return(server.CanExecuteCommand(this.Id, this.RequiredPermissions, channel, user));
        }
Пример #2
0
        /// <summary> Returns true if the User has permission to execute this command. </summary>
        /// <param name="commandChannelOptions"> List of all the channel options for specific command. </param>
        public bool CanExecute <TUser>(IBotwinderClient <TUser> client, Server <TUser> server, SocketGuildChannel channel,
                                       SocketGuildUser user) where TUser : UserData, new()
        {
            if (client.IsGlobalAdmin(user.Id))
            {
                return(true);
            }

            return(server.CanExecuteCommand(this.CommandId, PermissionType.Everyone, channel, user));
        }
Пример #3
0
        /// <summary> Returns true if the User has permission to execute this command. </summary>
        /// <param name="commandChannelOptions"> List of all the channel options for specific command. </param>
        public bool CanExecute(IBotwinderClient client, Server server, SocketGuildChannel channel,
                               SocketGuildUser user)
        {
            if (client.IsGlobalAdmin(user.Id))
            {
                return(true);
            }

            return(server.CanExecuteCommand(this.CommandId, PermissionType.Everyone, channel, user));
        }